199 #ifndef PY_SSIZE_T_CLEAN
200 #define PY_SSIZE_T_CLEAN
204 #error Python headers needed to compile C extensions, please install development version of Python.
205 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
206 #error Cython requires Python 2.6+ or Python 3.3+.
208 #define CYTHON_ABI "0_29_36"
209 #define CYTHON_HEX_VERSION 0x001D24F0
210 #define CYTHON_FUTURE_DIVISION 1
213 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
215 #if !defined(WIN32) && !defined(MS_WINDOWS)
227 #define DL_IMPORT(t) t
230 #define DL_EXPORT(t) t
232 #define __PYX_COMMA ,
233 #ifndef HAVE_LONG_LONG
234 #if PY_VERSION_HEX >= 0x02070000
235 #define HAVE_LONG_LONG
239 #define PY_LONG_LONG LONG_LONG
242 #define Py_HUGE_VAL HUGE_VAL
245 #define CYTHON_COMPILING_IN_PYPY 1
246 #define CYTHON_COMPILING_IN_PYSTON 0
247 #define CYTHON_COMPILING_IN_CPYTHON 0
248 #define CYTHON_COMPILING_IN_NOGIL 0
249 #undef CYTHON_USE_TYPE_SLOTS
250 #define CYTHON_USE_TYPE_SLOTS 0
251 #undef CYTHON_USE_PYTYPE_LOOKUP
252 #define CYTHON_USE_PYTYPE_LOOKUP 0
253 #if PY_VERSION_HEX < 0x03050000
254 #undef CYTHON_USE_ASYNC_SLOTS
255 #define CYTHON_USE_ASYNC_SLOTS 0
256 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
257 #define CYTHON_USE_ASYNC_SLOTS 1
259 #undef CYTHON_USE_PYLIST_INTERNALS
260 #define CYTHON_USE_PYLIST_INTERNALS 0
261 #undef CYTHON_USE_UNICODE_INTERNALS
262 #define CYTHON_USE_UNICODE_INTERNALS 0
263 #undef CYTHON_USE_UNICODE_WRITER
264 #define CYTHON_USE_UNICODE_WRITER 0
265 #undef CYTHON_USE_PYLONG_INTERNALS
266 #define CYTHON_USE_PYLONG_INTERNALS 0
267 #undef CYTHON_AVOID_BORROWED_REFS
268 #define CYTHON_AVOID_BORROWED_REFS 1
269 #undef CYTHON_ASSUME_SAFE_MACROS
270 #define CYTHON_ASSUME_SAFE_MACROS 0
271 #undef CYTHON_UNPACK_METHODS
272 #define CYTHON_UNPACK_METHODS 0
273 #undef CYTHON_FAST_THREAD_STATE
274 #define CYTHON_FAST_THREAD_STATE 0
275 #undef CYTHON_FAST_PYCALL
276 #define CYTHON_FAST_PYCALL 0
277 #if PY_VERSION_HEX < 0x03090000
278 #undef CYTHON_PEP489_MULTI_PHASE_INIT
279 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
280 #elif !defined(CYTHON_PEP489_MULTI_PHASE_INIT)
281 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
283 #undef CYTHON_USE_TP_FINALIZE
284 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1 && PYPY_VERSION_NUM >= 0x07030C00)
285 #undef CYTHON_USE_DICT_VERSIONS
286 #define CYTHON_USE_DICT_VERSIONS 0
287 #undef CYTHON_USE_EXC_INFO_STACK
288 #define CYTHON_USE_EXC_INFO_STACK 0
289 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
290 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
292 #elif defined(PYSTON_VERSION)
293 #define CYTHON_COMPILING_IN_PYPY 0
294 #define CYTHON_COMPILING_IN_PYSTON 1
295 #define CYTHON_COMPILING_IN_CPYTHON 0
296 #define CYTHON_COMPILING_IN_NOGIL 0
297 #ifndef CYTHON_USE_TYPE_SLOTS
298 #define CYTHON_USE_TYPE_SLOTS 1
300 #undef CYTHON_USE_PYTYPE_LOOKUP
301 #define CYTHON_USE_PYTYPE_LOOKUP 0
302 #undef CYTHON_USE_ASYNC_SLOTS
303 #define CYTHON_USE_ASYNC_SLOTS 0
304 #undef CYTHON_USE_PYLIST_INTERNALS
305 #define CYTHON_USE_PYLIST_INTERNALS 0
306 #ifndef CYTHON_USE_UNICODE_INTERNALS
307 #define CYTHON_USE_UNICODE_INTERNALS 1
309 #undef CYTHON_USE_UNICODE_WRITER
310 #define CYTHON_USE_UNICODE_WRITER 0
311 #undef CYTHON_USE_PYLONG_INTERNALS
312 #define CYTHON_USE_PYLONG_INTERNALS 0
313 #ifndef CYTHON_AVOID_BORROWED_REFS
314 #define CYTHON_AVOID_BORROWED_REFS 0
316 #ifndef CYTHON_ASSUME_SAFE_MACROS
317 #define CYTHON_ASSUME_SAFE_MACROS 1
319 #ifndef CYTHON_UNPACK_METHODS
320 #define CYTHON_UNPACK_METHODS 1
322 #undef CYTHON_FAST_THREAD_STATE
323 #define CYTHON_FAST_THREAD_STATE 0
324 #undef CYTHON_FAST_PYCALL
325 #define CYTHON_FAST_PYCALL 0
326 #undef CYTHON_PEP489_MULTI_PHASE_INIT
327 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
328 #undef CYTHON_USE_TP_FINALIZE
329 #define CYTHON_USE_TP_FINALIZE 0
330 #undef CYTHON_USE_DICT_VERSIONS
331 #define CYTHON_USE_DICT_VERSIONS 0
332 #undef CYTHON_USE_EXC_INFO_STACK
333 #define CYTHON_USE_EXC_INFO_STACK 0
334 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
335 #define CYTHON_UPDATE_DESCRIPTOR_DOC 0
337 #elif defined(PY_NOGIL)
338 #define CYTHON_COMPILING_IN_PYPY 0
339 #define CYTHON_COMPILING_IN_PYSTON 0
340 #define CYTHON_COMPILING_IN_CPYTHON 0
341 #define CYTHON_COMPILING_IN_NOGIL 1
342 #ifndef CYTHON_USE_TYPE_SLOTS
343 #define CYTHON_USE_TYPE_SLOTS 1
345 #undef CYTHON_USE_PYTYPE_LOOKUP
346 #define CYTHON_USE_PYTYPE_LOOKUP 0
347 #ifndef CYTHON_USE_ASYNC_SLOTS
348 #define CYTHON_USE_ASYNC_SLOTS 1
350 #undef CYTHON_USE_PYLIST_INTERNALS
351 #define CYTHON_USE_PYLIST_INTERNALS 0
352 #ifndef CYTHON_USE_UNICODE_INTERNALS
353 #define CYTHON_USE_UNICODE_INTERNALS 1
355 #undef CYTHON_USE_UNICODE_WRITER
356 #define CYTHON_USE_UNICODE_WRITER 0
357 #undef CYTHON_USE_PYLONG_INTERNALS
358 #define CYTHON_USE_PYLONG_INTERNALS 0
359 #ifndef CYTHON_AVOID_BORROWED_REFS
360 #define CYTHON_AVOID_BORROWED_REFS 0
362 #ifndef CYTHON_ASSUME_SAFE_MACROS
363 #define CYTHON_ASSUME_SAFE_MACROS 1
365 #ifndef CYTHON_UNPACK_METHODS
366 #define CYTHON_UNPACK_METHODS 1
368 #undef CYTHON_FAST_THREAD_STATE
369 #define CYTHON_FAST_THREAD_STATE 0
370 #undef CYTHON_FAST_PYCALL
371 #define CYTHON_FAST_PYCALL 0
372 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
373 #define CYTHON_PEP489_MULTI_PHASE_INIT 1
375 #ifndef CYTHON_USE_TP_FINALIZE
376 #define CYTHON_USE_TP_FINALIZE 1
378 #undef CYTHON_USE_DICT_VERSIONS
379 #define CYTHON_USE_DICT_VERSIONS 0
380 #undef CYTHON_USE_EXC_INFO_STACK
381 #define CYTHON_USE_EXC_INFO_STACK 0
383 #define CYTHON_COMPILING_IN_PYPY 0
384 #define CYTHON_COMPILING_IN_PYSTON 0
385 #define CYTHON_COMPILING_IN_CPYTHON 1
386 #define CYTHON_COMPILING_IN_NOGIL 0
387 #ifndef CYTHON_USE_TYPE_SLOTS
388 #define CYTHON_USE_TYPE_SLOTS 1
390 #if PY_VERSION_HEX < 0x02070000
391 #undef CYTHON_USE_PYTYPE_LOOKUP
392 #define CYTHON_USE_PYTYPE_LOOKUP 0
393 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
394 #define CYTHON_USE_PYTYPE_LOOKUP 1
396 #if PY_MAJOR_VERSION < 3
397 #undef CYTHON_USE_ASYNC_SLOTS
398 #define CYTHON_USE_ASYNC_SLOTS 0
399 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
400 #define CYTHON_USE_ASYNC_SLOTS 1
402 #if PY_VERSION_HEX < 0x02070000
403 #undef CYTHON_USE_PYLONG_INTERNALS
404 #define CYTHON_USE_PYLONG_INTERNALS 0
405 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
406 #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
408 #ifndef CYTHON_USE_PYLIST_INTERNALS
409 #define CYTHON_USE_PYLIST_INTERNALS 1
411 #ifndef CYTHON_USE_UNICODE_INTERNALS
412 #define CYTHON_USE_UNICODE_INTERNALS 1
414 #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2
415 #undef CYTHON_USE_UNICODE_WRITER
416 #define CYTHON_USE_UNICODE_WRITER 0
417 #elif !defined(CYTHON_USE_UNICODE_WRITER)
418 #define CYTHON_USE_UNICODE_WRITER 1
420 #ifndef CYTHON_AVOID_BORROWED_REFS
421 #define CYTHON_AVOID_BORROWED_REFS 0
423 #ifndef CYTHON_ASSUME_SAFE_MACROS
424 #define CYTHON_ASSUME_SAFE_MACROS 1
426 #ifndef CYTHON_UNPACK_METHODS
427 #define CYTHON_UNPACK_METHODS 1
429 #if PY_VERSION_HEX >= 0x030B00A4
430 #undef CYTHON_FAST_THREAD_STATE
431 #define CYTHON_FAST_THREAD_STATE 0
432 #elif !defined(CYTHON_FAST_THREAD_STATE)
433 #define CYTHON_FAST_THREAD_STATE 1
435 #ifndef CYTHON_FAST_PYCALL
436 #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
438 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
439 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
441 #ifndef CYTHON_USE_TP_FINALIZE
442 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
444 #ifndef CYTHON_USE_DICT_VERSIONS
445 #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
447 #if PY_VERSION_HEX >= 0x030B00A4
448 #undef CYTHON_USE_EXC_INFO_STACK
449 #define CYTHON_USE_EXC_INFO_STACK 0
450 #elif !defined(CYTHON_USE_EXC_INFO_STACK)
451 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
453 #ifndef CYTHON_UPDATE_DESCRIPTOR_DOC
454 #define CYTHON_UPDATE_DESCRIPTOR_DOC 1
457 #if !defined(CYTHON_FAST_PYCCALL)
458 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
460 #if CYTHON_USE_PYLONG_INTERNALS
461 #if PY_MAJOR_VERSION < 3
462 #include "longintrepr.h"
468 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P ==
sizeof(
void*)) };
471 #ifndef __has_attribute
472 #define __has_attribute(x) 0
474 #ifndef __has_cpp_attribute
475 #define __has_cpp_attribute(x) 0
477 #ifndef CYTHON_RESTRICT
478 #if defined(__GNUC__)
479 #define CYTHON_RESTRICT __restrict__
480 #elif defined(_MSC_VER) && _MSC_VER >= 1400
481 #define CYTHON_RESTRICT __restrict
482 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
483 #define CYTHON_RESTRICT restrict
485 #define CYTHON_RESTRICT
488 #ifndef CYTHON_UNUSED
489 # if defined(__GNUC__)
490 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
491 # define CYTHON_UNUSED __attribute__ ((__unused__))
493 # define CYTHON_UNUSED
495 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
496 # define CYTHON_UNUSED __attribute__ ((__unused__))
498 # define CYTHON_UNUSED
501 #ifndef CYTHON_MAYBE_UNUSED_VAR
502 # if defined(__cplusplus)
503 template<
class T>
void CYTHON_MAYBE_UNUSED_VAR(
const T& ) { }
505 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
508 #ifndef CYTHON_NCP_UNUSED
509 # if CYTHON_COMPILING_IN_CPYTHON
510 # define CYTHON_NCP_UNUSED
512 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
515 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
517 #ifndef _MSC_STDINT_H_
519 typedef unsigned char uint8_t;
520 typedef unsigned int uint32_t;
522 typedef unsigned __int8 uint8_t;
523 typedef unsigned __int32 uint32_t;
529 #ifndef CYTHON_FALLTHROUGH
530 #if defined(__cplusplus) && __cplusplus >= 201103L
531 #if __has_cpp_attribute(fallthrough)
532 #define CYTHON_FALLTHROUGH [[fallthrough]]
533 #elif __has_cpp_attribute(clang::fallthrough)
534 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
535 #elif __has_cpp_attribute(gnu::fallthrough)
536 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
539 #ifndef CYTHON_FALLTHROUGH
540 #if __has_attribute(fallthrough)
541 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
543 #define CYTHON_FALLTHROUGH
546 #if defined(__clang__ ) && defined(__apple_build_version__)
547 #if __apple_build_version__ < 7000000
548 #undef CYTHON_FALLTHROUGH
549 #define CYTHON_FALLTHROUGH
555 #error "Cython files generated with the C++ option must be compiled with a C++ compiler."
557 #ifndef CYTHON_INLINE
558 #if defined(__clang__)
559 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
561 #define CYTHON_INLINE inline
565 void __Pyx_call_destructor(T& x) {
569 class __Pyx_FakeReference {
571 __Pyx_FakeReference() : ptr(NULL) { }
572 __Pyx_FakeReference(
const T& ref) : ptr(const_cast<T*>(&ref)) { }
573 T *operator->() {
return ptr; }
574 T *operator&() {
return ptr; }
575 operator T&() {
return *ptr; }
576 template<
typename U>
bool operator ==(U other) {
return *ptr == other; }
577 template<
typename U>
bool operator !=(U other) {
return *ptr != other; }
582 #define __PYX_BUILD_PY_SSIZE_T "n"
583 #define CYTHON_FORMAT_SSIZE_T "z"
584 #if PY_MAJOR_VERSION < 3
585 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
586 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
587 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
588 #define __Pyx_DefaultClassType PyClass_Type
590 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
591 #define __Pyx_DefaultClassType PyType_Type
592 #if PY_VERSION_HEX >= 0x030B00A1
593 static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(
int a,
int k,
int l,
int s,
int f,
594 PyObject *code, PyObject *c, PyObject* n, PyObject *v,
595 PyObject *fv, PyObject *cell, PyObject* fn,
596 PyObject *name,
int fline, PyObject *lnos) {
597 PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL;
598 PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL;
599 const char *fn_cstr=NULL;
600 const char *name_cstr=NULL;
601 PyCodeObject* co=NULL;
602 PyObject *type, *value, *traceback;
603 PyErr_Fetch(&type, &value, &traceback);
604 if (!(kwds=PyDict_New()))
goto end;
605 if (!(argcount=PyLong_FromLong(a)))
goto end;
606 if (PyDict_SetItemString(kwds,
"co_argcount", argcount) != 0)
goto end;
607 if (!(posonlyargcount=PyLong_FromLong(0)))
goto end;
608 if (PyDict_SetItemString(kwds,
"co_posonlyargcount", posonlyargcount) != 0)
goto end;
609 if (!(kwonlyargcount=PyLong_FromLong(k)))
goto end;
610 if (PyDict_SetItemString(kwds,
"co_kwonlyargcount", kwonlyargcount) != 0)
goto end;
611 if (!(nlocals=PyLong_FromLong(l)))
goto end;
612 if (PyDict_SetItemString(kwds,
"co_nlocals", nlocals) != 0)
goto end;
613 if (!(stacksize=PyLong_FromLong(s)))
goto end;
614 if (PyDict_SetItemString(kwds,
"co_stacksize", stacksize) != 0)
goto end;
615 if (!(flags=PyLong_FromLong(f)))
goto end;
616 if (PyDict_SetItemString(kwds,
"co_flags", flags) != 0)
goto end;
617 if (PyDict_SetItemString(kwds,
"co_code", code) != 0)
goto end;
618 if (PyDict_SetItemString(kwds,
"co_consts", c) != 0)
goto end;
619 if (PyDict_SetItemString(kwds,
"co_names", n) != 0)
goto end;
620 if (PyDict_SetItemString(kwds,
"co_varnames", v) != 0)
goto end;
621 if (PyDict_SetItemString(kwds,
"co_freevars", fv) != 0)
goto end;
622 if (PyDict_SetItemString(kwds,
"co_cellvars", cell) != 0)
goto end;
623 if (PyDict_SetItemString(kwds,
"co_linetable", lnos) != 0)
goto end;
624 if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL)))
goto end;
625 if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL)))
goto end;
626 if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline)))
goto end;
627 if (!(replace = PyObject_GetAttrString((PyObject*)co,
"replace")))
goto cleanup_code_too;
628 if (!(empty = PyTuple_New(0)))
goto cleanup_code_too;
629 if (!(call_result = PyObject_Call(replace, empty, kwds)))
goto cleanup_code_too;
630 Py_XDECREF((PyObject*)co);
631 co = (PyCodeObject*)call_result;
635 Py_XDECREF((PyObject*)co);
640 Py_XDECREF(argcount);
641 Py_XDECREF(posonlyargcount);
642 Py_XDECREF(kwonlyargcount);
644 Py_XDECREF(stacksize);
646 Py_XDECREF(call_result);
649 PyErr_Restore(type, value, traceback);
654 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
655 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
657 #define __Pyx_DefaultClassType PyType_Type
659 #if PY_VERSION_HEX >= 0x030900F0 && !CYTHON_COMPILING_IN_PYPY
660 #define __Pyx_PyObject_GC_IsFinalized(o) PyObject_GC_IsFinalized(o)
662 #define __Pyx_PyObject_GC_IsFinalized(o) _PyGC_FINALIZED(o)
664 #ifndef Py_TPFLAGS_CHECKTYPES
665 #define Py_TPFLAGS_CHECKTYPES 0
667 #ifndef Py_TPFLAGS_HAVE_INDEX
668 #define Py_TPFLAGS_HAVE_INDEX 0
670 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
671 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
673 #ifndef Py_TPFLAGS_HAVE_FINALIZE
674 #define Py_TPFLAGS_HAVE_FINALIZE 0
676 #ifndef METH_STACKLESS
677 #define METH_STACKLESS 0
679 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
680 #ifndef METH_FASTCALL
681 #define METH_FASTCALL 0x80
683 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *
self, PyObject *
const *args, Py_ssize_t nargs);
684 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *
self, PyObject *
const *args,
685 Py_ssize_t nargs, PyObject *kwnames);
687 #define __Pyx_PyCFunctionFast _PyCFunctionFast
688 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
690 #if CYTHON_FAST_PYCCALL
691 #define __Pyx_PyFastCFunction_Check(func)\
692 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
694 #define __Pyx_PyFastCFunction_Check(func) 0
696 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
697 #define PyObject_Malloc(s) PyMem_Malloc(s)
698 #define PyObject_Free(p) PyMem_Free(p)
699 #define PyObject_Realloc(p) PyMem_Realloc(p)
701 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
702 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
703 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
704 #define PyMem_RawFree(p) PyMem_Free(p)
706 #if CYTHON_COMPILING_IN_PYSTON
707 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
708 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
710 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
711 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
713 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
714 #define __Pyx_PyThreadState_Current PyThreadState_GET()
715 #elif PY_VERSION_HEX >= 0x03060000
716 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
717 #elif PY_VERSION_HEX >= 0x03000000
718 #define __Pyx_PyThreadState_Current PyThreadState_GET()
720 #define __Pyx_PyThreadState_Current _PyThreadState_Current
722 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
723 #include "pythread.h"
724 #define Py_tss_NEEDS_INIT 0
725 typedef int Py_tss_t;
726 static CYTHON_INLINE
int PyThread_tss_create(Py_tss_t *key) {
727 *key = PyThread_create_key();
730 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(
void) {
731 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(
sizeof(Py_tss_t));
732 *key = Py_tss_NEEDS_INIT;
735 static CYTHON_INLINE
void PyThread_tss_free(Py_tss_t *key) {
738 static CYTHON_INLINE
int PyThread_tss_is_created(Py_tss_t *key) {
739 return *key != Py_tss_NEEDS_INIT;
741 static CYTHON_INLINE
void PyThread_tss_delete(Py_tss_t *key) {
742 PyThread_delete_key(*key);
743 *key = Py_tss_NEEDS_INIT;
745 static CYTHON_INLINE
int PyThread_tss_set(Py_tss_t *key,
void *value) {
746 return PyThread_set_key_value(*key, value);
748 static CYTHON_INLINE
void * PyThread_tss_get(Py_tss_t *key) {
749 return PyThread_get_key_value(*key);
752 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
753 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
755 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
757 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
758 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
759 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
761 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
762 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
764 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
765 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
767 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
769 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
770 #define CYTHON_PEP393_ENABLED 1
771 #if PY_VERSION_HEX >= 0x030C0000
772 #define __Pyx_PyUnicode_READY(op) (0)
774 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
775 0 : _PyUnicode_Ready((PyObject *)(op)))
777 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
778 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
779 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
780 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
781 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
782 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
783 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
784 #if PY_VERSION_HEX >= 0x030C0000
785 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
787 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000
788 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length))
790 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
794 #define CYTHON_PEP393_ENABLED 0
795 #define PyUnicode_1BYTE_KIND 1
796 #define PyUnicode_2BYTE_KIND 2
797 #define PyUnicode_4BYTE_KIND 4
798 #define __Pyx_PyUnicode_READY(op) (0)
799 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
800 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
801 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
802 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
803 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
804 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
805 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
806 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
808 #if CYTHON_COMPILING_IN_PYPY
809 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
810 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
812 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
813 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
814 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
816 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
817 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
819 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
820 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
822 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
823 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
825 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
826 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
827 #if PY_MAJOR_VERSION >= 3
828 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
830 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
832 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
833 #define PyObject_ASCII(o) PyObject_Repr(o)
835 #if PY_MAJOR_VERSION >= 3
836 #define PyBaseString_Type PyUnicode_Type
837 #define PyStringObject PyUnicodeObject
838 #define PyString_Type PyUnicode_Type
839 #define PyString_Check PyUnicode_Check
840 #define PyString_CheckExact PyUnicode_CheckExact
841 #ifndef PyObject_Unicode
842 #define PyObject_Unicode PyObject_Str
845 #if PY_MAJOR_VERSION >= 3
846 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
847 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
849 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
850 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
852 #ifndef PySet_CheckExact
853 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
855 #if PY_VERSION_HEX >= 0x030900A4
856 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
857 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
859 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
860 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
862 #if CYTHON_ASSUME_SAFE_MACROS
863 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
865 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
867 #if PY_MAJOR_VERSION >= 3
868 #define PyIntObject PyLongObject
869 #define PyInt_Type PyLong_Type
870 #define PyInt_Check(op) PyLong_Check(op)
871 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
872 #define PyInt_FromString PyLong_FromString
873 #define PyInt_FromUnicode PyLong_FromUnicode
874 #define PyInt_FromLong PyLong_FromLong
875 #define PyInt_FromSize_t PyLong_FromSize_t
876 #define PyInt_FromSsize_t PyLong_FromSsize_t
877 #define PyInt_AsLong PyLong_AsLong
878 #define PyInt_AS_LONG PyLong_AS_LONG
879 #define PyInt_AsSsize_t PyLong_AsSsize_t
880 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
881 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
882 #define PyNumber_Int PyNumber_Long
884 #if PY_MAJOR_VERSION >= 3
885 #define PyBoolObject PyLongObject
887 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
888 #ifndef PyUnicode_InternFromString
889 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
892 #if PY_VERSION_HEX < 0x030200A4
893 typedef long Py_hash_t;
894 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
895 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t
897 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
898 #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t
900 #if PY_MAJOR_VERSION >= 3
901 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
903 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
905 #if CYTHON_USE_ASYNC_SLOTS
906 #if PY_VERSION_HEX >= 0x030500B1
907 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
908 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
910 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
913 #define __Pyx_PyType_AsAsync(obj) NULL
915 #ifndef __Pyx_PyAsyncMethodsStruct
920 } __Pyx_PyAsyncMethodsStruct;
923 #if defined(_WIN32) || defined(WIN32) || defined(MS_WINDOWS)
924 #if !defined(_USE_MATH_DEFINES)
925 #define _USE_MATH_DEFINES
930 #define __PYX_NAN() ((float) NAN)
932 static CYTHON_INLINE
float __PYX_NAN() {
934 memset(&value, 0xFF,
sizeof(value));
938 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
939 #define __Pyx_truncl trunc
941 #define __Pyx_truncl truncl
944 #define __PYX_MARK_ERR_POS(f_index, lineno) \
945 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
946 #define __PYX_ERR(f_index, lineno, Ln_error) \
947 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
949 #ifndef __PYX_EXTERN_C
951 #define __PYX_EXTERN_C extern "C"
953 #define __PYX_EXTERN_C extern
957 #define __PYX_HAVE__imate___c_trace_estimator__py_c_trace_estimator
958 #define __PYX_HAVE_API__imate___c_trace_estimator__py_c_trace_estimator
978 #include "pythread.h"
985 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
986 #define CYTHON_WITHOUT_ASSERTIONS
989 typedef struct {PyObject **p;
const char *s;
const Py_ssize_t n;
const char* encoding;
990 const char is_unicode;
const char is_str;
const char intern; } __Pyx_StringTabEntry;
992 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
993 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
994 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
995 #define __PYX_DEFAULT_STRING_ENCODING ""
996 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
997 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
998 #define __Pyx_uchar_cast(c) ((unsigned char)c)
999 #define __Pyx_long_cast(x) ((long)x)
1000 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
1001 (sizeof(type) < sizeof(Py_ssize_t)) ||\
1002 (sizeof(type) > sizeof(Py_ssize_t) &&\
1003 likely(v < (type)PY_SSIZE_T_MAX ||\
1004 v == (type)PY_SSIZE_T_MAX) &&\
1005 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
1006 v == (type)PY_SSIZE_T_MIN))) ||\
1007 (sizeof(type) == sizeof(Py_ssize_t) &&\
1008 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
1009 v == (type)PY_SSIZE_T_MAX))) )
1010 static CYTHON_INLINE
int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
1011 return (
size_t) i < (size_t) limit;
1013 #if defined (__cplusplus) && __cplusplus >= 201103L
1015 #define __Pyx_sst_abs(value) std::abs(value)
1016 #elif SIZEOF_INT >= SIZEOF_SIZE_T
1017 #define __Pyx_sst_abs(value) abs(value)
1018 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
1019 #define __Pyx_sst_abs(value) labs(value)
1020 #elif defined (_MSC_VER)
1021 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
1022 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1023 #define __Pyx_sst_abs(value) llabs(value)
1024 #elif defined (__GNUC__)
1025 #define __Pyx_sst_abs(value) __builtin_llabs(value)
1027 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
1029 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject*);
1030 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
1031 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
1032 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
1033 #define __Pyx_PyBytes_FromString PyBytes_FromString
1034 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
1035 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char*);
1036 #if PY_MAJOR_VERSION < 3
1037 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
1038 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
1040 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
1041 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
1043 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
1044 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
1045 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
1046 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
1047 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
1048 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
1049 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
1050 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
1051 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
1052 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
1053 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
1054 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
1055 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
1056 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
1057 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
1058 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
1059 static CYTHON_INLINE
size_t __Pyx_Py_UNICODE_strlen(
const Py_UNICODE *u) {
1060 const Py_UNICODE *u_end = u;
1062 return (
size_t)(u_end - u - 1);
1064 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
1065 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
1066 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
1067 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
1068 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
1069 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b);
1070 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject*);
1071 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
1072 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
1073 #define __Pyx_PySequence_Tuple(obj)\
1074 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
1075 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
1076 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t);
1077 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*);
1078 #if CYTHON_ASSUME_SAFE_MACROS
1079 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
1081 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
1083 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
1084 #if PY_MAJOR_VERSION >= 3
1085 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
1087 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
1089 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
1090 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
1091 static int __Pyx_sys_getdefaultencoding_not_ascii;
1092 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1094 PyObject* default_encoding = NULL;
1095 PyObject* ascii_chars_u = NULL;
1096 PyObject* ascii_chars_b = NULL;
1097 const char* default_encoding_c;
1098 sys = PyImport_ImportModule(
"sys");
1100 default_encoding = PyObject_CallMethod(sys, (
char*)
"getdefaultencoding", NULL);
1102 if (!default_encoding)
goto bad;
1103 default_encoding_c = PyBytes_AsString(default_encoding);
1104 if (!default_encoding_c)
goto bad;
1105 if (strcmp(default_encoding_c,
"ascii") == 0) {
1106 __Pyx_sys_getdefaultencoding_not_ascii = 0;
1108 char ascii_chars[128];
1110 for (c = 0; c < 128; c++) {
1113 __Pyx_sys_getdefaultencoding_not_ascii = 1;
1114 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
1115 if (!ascii_chars_u)
goto bad;
1116 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
1117 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
1120 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
1121 default_encoding_c);
1124 Py_DECREF(ascii_chars_u);
1125 Py_DECREF(ascii_chars_b);
1127 Py_DECREF(default_encoding);
1130 Py_XDECREF(default_encoding);
1131 Py_XDECREF(ascii_chars_u);
1132 Py_XDECREF(ascii_chars_b);
1136 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
1137 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
1139 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
1140 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
1141 static char* __PYX_DEFAULT_STRING_ENCODING;
1142 static int __Pyx_init_sys_getdefaultencoding_params(
void) {
1144 PyObject* default_encoding = NULL;
1145 char* default_encoding_c;
1146 sys = PyImport_ImportModule(
"sys");
1148 default_encoding = PyObject_CallMethod(sys, (
char*) (
const char*)
"getdefaultencoding", NULL);
1150 if (!default_encoding)
goto bad;
1151 default_encoding_c = PyBytes_AsString(default_encoding);
1152 if (!default_encoding_c)
goto bad;
1153 __PYX_DEFAULT_STRING_ENCODING = (
char*) malloc(strlen(default_encoding_c) + 1);
1154 if (!__PYX_DEFAULT_STRING_ENCODING)
goto bad;
1155 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
1156 Py_DECREF(default_encoding);
1159 Py_XDECREF(default_encoding);
1167 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
1168 #define likely(x) __builtin_expect(!!(x), 1)
1169 #define unlikely(x) __builtin_expect(!!(x), 0)
1171 #define likely(x) (x)
1172 #define unlikely(x) (x)
1174 static CYTHON_INLINE
void __Pyx_pretend_to_initialize(
void* ptr) { (void)ptr; }
1176 static PyObject *__pyx_m = NULL;
1177 static PyObject *__pyx_d;
1178 static PyObject *__pyx_b;
1179 static PyObject *__pyx_cython_runtime = NULL;
1180 static PyObject *__pyx_empty_tuple;
1181 static PyObject *__pyx_empty_bytes;
1182 static PyObject *__pyx_empty_unicode;
1183 static int __pyx_lineno;
1184 static int __pyx_clineno = 0;
1185 static const char * __pyx_cfilenm= __FILE__;
1186 static const char *__pyx_filename;
1189 #if !defined(CYTHON_CCOMPLEX)
1190 #if defined(__cplusplus)
1191 #define CYTHON_CCOMPLEX 1
1192 #elif defined(_Complex_I)
1193 #define CYTHON_CCOMPLEX 1
1195 #define CYTHON_CCOMPLEX 0
1202 #include <complex.h>
1205 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
1207 #define _Complex_I 1.0fj
1211 static const char *__pyx_f[] = {
1212 "imate/_c_trace_estimator/py_c_trace_estimator.pyx",
1213 "imate/_c_trace_estimator/lapack_api.pxi",
1215 "imate/functions/py_functions.pxd",
1216 "imate/_c_linear_operator/py_c_linear_operator.pxd",
1217 "imate/_c_linear_operator/py_c_matrix.pxd",
1218 "imate/_c_linear_operator/py_c_affine_matrix_function.pxd",
1221 struct __pyx_memoryview_obj;
1223 struct __pyx_memoryview_obj *memview;
1225 Py_ssize_t shape[8];
1226 Py_ssize_t strides[8];
1227 Py_ssize_t suboffsets[8];
1228 } __Pyx_memviewslice;
1229 #define __Pyx_MemoryView_Len(m) (m.shape[0])
1232 #include <pythread.h>
1233 #ifndef CYTHON_ATOMICS
1234 #define CYTHON_ATOMICS 1
1236 #define __PYX_CYTHON_ATOMICS_ENABLED() CYTHON_ATOMICS
1237 #define __pyx_atomic_int_type int
1238 #if CYTHON_ATOMICS && (__GNUC__ >= 5 || (__GNUC__ == 4 &&\
1239 (__GNUC_MINOR__ > 1 ||\
1240 (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 2))))
1241 #define __pyx_atomic_incr_aligned(value) __sync_fetch_and_add(value, 1)
1242 #define __pyx_atomic_decr_aligned(value) __sync_fetch_and_sub(value, 1)
1243 #ifdef __PYX_DEBUG_ATOMICS
1244 #warning "Using GNU atomics"
1246 #elif CYTHON_ATOMICS && defined(_MSC_VER) && CYTHON_COMPILING_IN_NOGIL
1248 #undef __pyx_atomic_int_type
1249 #define __pyx_atomic_int_type long
1250 #pragma intrinsic (_InterlockedExchangeAdd)
1251 #define __pyx_atomic_incr_aligned(value) _InterlockedExchangeAdd(value, 1)
1252 #define __pyx_atomic_decr_aligned(value) _InterlockedExchangeAdd(value, -1)
1253 #ifdef __PYX_DEBUG_ATOMICS
1254 #pragma message ("Using MSVC atomics")
1257 #undef CYTHON_ATOMICS
1258 #define CYTHON_ATOMICS 0
1259 #ifdef __PYX_DEBUG_ATOMICS
1260 #warning "Not using atomics"
1263 typedef volatile __pyx_atomic_int_type __pyx_atomic_int;
1265 #define __pyx_add_acquisition_count(memview)\
1266 __pyx_atomic_incr_aligned(__pyx_get_slice_count_pointer(memview))
1267 #define __pyx_sub_acquisition_count(memview)\
1268 __pyx_atomic_decr_aligned(__pyx_get_slice_count_pointer(memview))
1270 #define __pyx_add_acquisition_count(memview)\
1271 __pyx_add_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1272 #define __pyx_sub_acquisition_count(memview)\
1273 __pyx_sub_acquisition_count_locked(__pyx_get_slice_count_pointer(memview), memview->lock)
1277 #ifndef __PYX_FORCE_INIT_THREADS
1278 #define __PYX_FORCE_INIT_THREADS 0
1282 #define __Pyx_PyGILState_Ensure PyGILState_Ensure
1283 #define __Pyx_PyGILState_Release PyGILState_Release
1284 #define __Pyx_FastGIL_Remember()
1285 #define __Pyx_FastGIL_Forget()
1286 #define __Pyx_FastGilFuncInit()
1289 #define IS_UNSIGNED(type) (((type) -1) > 0)
1290 struct __Pyx_StructField_;
1291 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
1294 struct __Pyx_StructField_* fields;
1296 size_t arraysize[8];
1302 typedef struct __Pyx_StructField_ {
1303 __Pyx_TypeInfo* type;
1306 } __Pyx_StructField;
1308 __Pyx_StructField* field;
1309 size_t parent_offset;
1310 } __Pyx_BufFmt_StackElem;
1312 __Pyx_StructField root;
1313 __Pyx_BufFmt_StackElem* head;
1315 size_t new_count, enc_count;
1316 size_t struct_alignment;
1321 char is_valid_array;
1322 } __Pyx_BufFmt_Context;
1332 typedef int __pyx_t_5imate_12_definitions_5types_LongIndexType;
1341 typedef int const __pyx_t_5imate_12_definitions_5types_ConstLongIndexType;
1350 typedef int __pyx_t_5imate_12_definitions_5types_IndexType;
1359 typedef int const __pyx_t_5imate_12_definitions_5types_ConstIndexType;
1368 typedef int __pyx_t_5imate_12_definitions_5types_FlagType;
1377 typedef int const __pyx_t_5imate_12_definitions_5types_ConstFlagType;
1386 typedef float __pyx_t_5scipy_6linalg_13cython_lapack_s;
1395 typedef double __pyx_t_5scipy_6linalg_13cython_lapack_d;
1404 typedef long double __pyx_t_5imate_18_c_trace_estimator_20py_c_trace_estimator_long_double;
1408 typedef ::std::complex< float > __pyx_t_float_complex;
1410 typedef float _Complex __pyx_t_float_complex;
1413 typedef struct {
float real, imag; } __pyx_t_float_complex;
1415 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float,
float);
1420 typedef ::std::complex< double > __pyx_t_double_complex;
1422 typedef double _Complex __pyx_t_double_complex;
1425 typedef struct {
double real, imag; } __pyx_t_double_complex;
1427 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double,
double);
1431 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction;
1432 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator;
1433 struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix;
1434 struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction;
1435 struct __pyx_array_obj;
1436 struct __pyx_MemviewEnum_obj;
1437 struct __pyx_memoryview_obj;
1438 struct __pyx_memoryviewslice_obj;
1447 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewLongIndexType;
1456 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType;
1465 typedef __Pyx_memviewslice __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType;
1474 typedef double (*__pyx_t_5imate_12_definitions_5types_kernel_type)(
double const ,
double const );
1483 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_cselect1(__pyx_t_float_complex *);
1492 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_cselect2(__pyx_t_float_complex *, __pyx_t_float_complex *);
1501 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_dselect2(__pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *);
1510 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_dselect3(__pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *);
1519 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_sselect2(__pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *);
1528 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_sselect3(__pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *);
1537 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_zselect1(__pyx_t_double_complex *);
1546 typedef int __pyx_t_5scipy_6linalg_13cython_lapack_zselect2(__pyx_t_double_complex *, __pyx_t_double_complex *);
1555 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction {
1557 struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *__pyx_vtab;
1569 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator {
1571 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_vtab;
1575 char *data_type_name;
1576 char *long_index_type_name;
1577 __pyx_t_5imate_12_definitions_5types_IndexType num_parameters;
1578 PyObject *parameters;
1589 struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix {
1590 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1592 PyObject *A_indices_copy;
1593 PyObject *A_index_pointer_copy;
1604 struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction {
1605 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1608 PyObject *A_indices_copy;
1609 PyObject *A_index_pointer_copy;
1610 PyObject *B_indices_copy;
1611 PyObject *B_index_pointer_copy;
1622 struct __pyx_array_obj {
1624 struct __pyx_vtabstruct_array *__pyx_vtab;
1630 Py_ssize_t *_strides;
1631 Py_ssize_t itemsize;
1634 void (*callback_free_data)(
void *);
1636 int dtype_is_object;
1647 struct __pyx_MemviewEnum_obj {
1660 struct __pyx_memoryview_obj {
1662 struct __pyx_vtabstruct_memoryview *__pyx_vtab;
1665 PyObject *_array_interface;
1666 PyThread_type_lock lock;
1667 __pyx_atomic_int acquisition_count[2];
1668 __pyx_atomic_int *acquisition_count_aligned_p;
1671 int dtype_is_object;
1672 __Pyx_TypeInfo *typeinfo;
1683 struct __pyx_memoryviewslice_obj {
1684 struct __pyx_memoryview_obj __pyx_base;
1685 __Pyx_memviewslice from_slice;
1686 PyObject *from_object;
1687 PyObject *(*to_object_func)(
char *);
1688 int (*to_dtype_func)(
char *, PyObject *);
1701 struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction {
1702 void (*set_function)(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *,
Function *);
1703 Function *(*get_function)(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *);
1705 static struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *__pyx_vtabptr_5imate_9functions_12py_functions_pyFunction;
1716 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator {
1717 __pyx_t_5imate_12_definitions_5types_LongIndexType (*get_num_rows)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1718 __pyx_t_5imate_12_definitions_5types_LongIndexType (*get_num_columns)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1719 cLinearOperator<float> *(*get_linear_operator_float)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1720 cLinearOperator<double> *(*get_linear_operator_double)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1721 cLinearOperator<long double> *(*get_linear_operator_long_double)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *);
1722 void (*dot)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
1723 void (*transpose_dot)(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
1725 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator;
1736 struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix {
1737 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1739 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix *__pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix;
1750 struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction {
1751 struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator __pyx_base;
1753 static struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction *__pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction;
1764 struct __pyx_vtabstruct_array {
1765 PyObject *(*get_memview)(
struct __pyx_array_obj *);
1767 static struct __pyx_vtabstruct_array *__pyx_vtabptr_array;
1778 struct __pyx_vtabstruct_memoryview {
1779 char *(*get_item_pointer)(
struct __pyx_memoryview_obj *, PyObject *);
1780 PyObject *(*is_slice)(
struct __pyx_memoryview_obj *, PyObject *);
1781 PyObject *(*setitem_slice_assignment)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1782 PyObject *(*setitem_slice_assign_scalar)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *);
1783 PyObject *(*setitem_indexed)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *);
1784 PyObject *(*convert_item_to_object)(
struct __pyx_memoryview_obj *,
char *);
1785 PyObject *(*assign_item_from_object)(
struct __pyx_memoryview_obj *,
char *, PyObject *);
1787 static struct __pyx_vtabstruct_memoryview *__pyx_vtabptr_memoryview;
1798 struct __pyx_vtabstruct__memoryviewslice {
1799 struct __pyx_vtabstruct_memoryview __pyx_base;
1801 static struct __pyx_vtabstruct__memoryviewslice *__pyx_vtabptr__memoryviewslice;
1805 #ifndef CYTHON_REFNANNY
1806 #define CYTHON_REFNANNY 0
1810 void (*INCREF)(
void*, PyObject*, int);
1811 void (*DECREF)(
void*, PyObject*, int);
1812 void (*GOTREF)(
void*, PyObject*, int);
1813 void (*GIVEREF)(
void*, PyObject*, int);
1814 void* (*SetupContext)(
const char*, int,
const char*);
1815 void (*FinishContext)(
void**);
1816 } __Pyx_RefNannyAPIStruct;
1817 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1818 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname);
1819 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1821 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1823 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1824 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1825 PyGILState_Release(__pyx_gilstate_save);\
1827 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1830 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1831 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1833 #define __Pyx_RefNannyFinishContext()\
1834 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1835 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1836 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1837 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1838 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1839 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1840 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1841 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1842 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1844 #define __Pyx_RefNannyDeclarations
1845 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1846 #define __Pyx_RefNannyFinishContext()
1847 #define __Pyx_INCREF(r) Py_INCREF(r)
1848 #define __Pyx_DECREF(r) Py_DECREF(r)
1849 #define __Pyx_GOTREF(r)
1850 #define __Pyx_GIVEREF(r)
1851 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1852 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1853 #define __Pyx_XGOTREF(r)
1854 #define __Pyx_XGIVEREF(r)
1856 #define __Pyx_XDECREF_SET(r, v) do {\
1857 PyObject *tmp = (PyObject *) r;\
1858 r = v; __Pyx_XDECREF(tmp);\
1860 #define __Pyx_DECREF_SET(r, v) do {\
1861 PyObject *tmp = (PyObject *) r;\
1862 r = v; __Pyx_DECREF(tmp);\
1864 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1865 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1868 #if CYTHON_USE_TYPE_SLOTS
1869 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1871 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1875 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1878 #if CYTHON_FAST_THREAD_STATE
1879 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1880 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1881 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1883 #define __Pyx_PyThreadState_declare
1884 #define __Pyx_PyThreadState_assign
1885 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1889 #if CYTHON_FAST_THREAD_STATE
1890 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1891 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1892 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1893 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1894 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1895 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1896 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1897 #if CYTHON_COMPILING_IN_CPYTHON
1898 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1900 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1903 #define __Pyx_PyErr_Clear() PyErr_Clear()
1904 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1905 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1906 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1907 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1908 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1909 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1910 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1914 #ifndef CYTHON_PROFILE
1915 #if CYTHON_COMPILING_IN_PYPY || CYTHON_COMPILING_IN_PYSTON
1916 #define CYTHON_PROFILE 0
1918 #define CYTHON_PROFILE 1
1921 #ifndef CYTHON_TRACE_NOGIL
1922 #define CYTHON_TRACE_NOGIL 0
1924 #if CYTHON_TRACE_NOGIL && !defined(CYTHON_TRACE)
1925 #define CYTHON_TRACE 1
1928 #ifndef CYTHON_TRACE
1929 #define CYTHON_TRACE 0
1932 #undef CYTHON_PROFILE_REUSE_FRAME
1934 #ifndef CYTHON_PROFILE_REUSE_FRAME
1935 #define CYTHON_PROFILE_REUSE_FRAME 0
1937 #if CYTHON_PROFILE || CYTHON_TRACE
1938 #include "compile.h"
1939 #include "frameobject.h"
1940 #include "traceback.h"
1941 #if PY_VERSION_HEX >= 0x030b00a6
1942 #ifndef Py_BUILD_CORE
1943 #define Py_BUILD_CORE 1
1945 #include "internal/pycore_frame.h"
1947 #if CYTHON_PROFILE_REUSE_FRAME
1948 #define CYTHON_FRAME_MODIFIER static
1949 #define CYTHON_FRAME_DEL(frame)
1951 #define CYTHON_FRAME_MODIFIER
1952 #define CYTHON_FRAME_DEL(frame) Py_CLEAR(frame)
1954 #define __Pyx_TraceDeclarations\
1955 static PyCodeObject *__pyx_frame_code = NULL;\
1956 CYTHON_FRAME_MODIFIER PyFrameObject *__pyx_frame = NULL;\
1957 int __Pyx_use_tracing = 0;
1958 #define __Pyx_TraceFrameInit(codeobj)\
1959 if (codeobj) __pyx_frame_code = (PyCodeObject*) codeobj;
1960 #if PY_VERSION_HEX >= 0x030b00a2
1961 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1962 (unlikely((tstate)->cframe->use_tracing) &&\
1963 (!(check_tracing) || !(tstate)->tracing) &&\
1964 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1965 #define __Pyx_EnterTracing(tstate) PyThreadState_EnterTracing(tstate)
1966 #define __Pyx_LeaveTracing(tstate) PyThreadState_LeaveTracing(tstate)
1967 #elif PY_VERSION_HEX >= 0x030a00b1
1968 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1969 (unlikely((tstate)->cframe->use_tracing) &&\
1970 (!(check_tracing) || !(tstate)->tracing) &&\
1971 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1972 #define __Pyx_EnterTracing(tstate)\
1973 do { tstate->tracing++; tstate->cframe->use_tracing = 0; } while (0)
1974 #define __Pyx_LeaveTracing(tstate)\
1977 tstate->cframe->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1978 || tstate->c_profilefunc != NULL);\
1981 #define __Pyx_IsTracing(tstate, check_tracing, check_funcs)\
1982 (unlikely((tstate)->use_tracing) &&\
1983 (!(check_tracing) || !(tstate)->tracing) &&\
1984 (!(check_funcs) || (tstate)->c_profilefunc || (CYTHON_TRACE && (tstate)->c_tracefunc)))
1985 #define __Pyx_EnterTracing(tstate)\
1986 do { tstate->tracing++; tstate->use_tracing = 0; } while (0)
1987 #define __Pyx_LeaveTracing(tstate)\
1990 tstate->use_tracing = ((CYTHON_TRACE && tstate->c_tracefunc != NULL)\
1991 || tstate->c_profilefunc != NULL);\
1995 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
1997 if (CYTHON_TRACE_NOGIL) {\
1998 PyThreadState *tstate;\
1999 PyGILState_STATE state = PyGILState_Ensure();\
2000 tstate = __Pyx_PyThreadState_Current;\
2001 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2002 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2004 PyGILState_Release(state);\
2005 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2008 PyThreadState* tstate = PyThreadState_GET();\
2009 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2010 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2011 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2015 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error)\
2016 { PyThreadState* tstate = PyThreadState_GET();\
2017 if (__Pyx_IsTracing(tstate, 1, 1)) {\
2018 __Pyx_use_tracing = __Pyx_TraceSetupAndCall(&__pyx_frame_code, &__pyx_frame, tstate, funcname, srcfile, firstlineno);\
2019 if (unlikely(__Pyx_use_tracing < 0)) goto_error;\
2023 #define __Pyx_TraceException()\
2024 if (likely(!__Pyx_use_tracing)); else {\
2025 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2026 if (__Pyx_IsTracing(tstate, 0, 1)) {\
2027 __Pyx_EnterTracing(tstate);\
2028 PyObject *exc_info = __Pyx_GetExceptionTuple(tstate);\
2030 if (CYTHON_TRACE && tstate->c_tracefunc)\
2031 tstate->c_tracefunc(\
2032 tstate->c_traceobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
2033 tstate->c_profilefunc(\
2034 tstate->c_profileobj, __pyx_frame, PyTrace_EXCEPTION, exc_info);\
2035 Py_DECREF(exc_info);\
2037 __Pyx_LeaveTracing(tstate);\
2040 static void __Pyx_call_return_trace_func(PyThreadState *tstate, PyFrameObject *frame, PyObject *result) {
2041 PyObject *type, *value, *traceback;
2042 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
2043 __Pyx_EnterTracing(tstate);
2044 if (CYTHON_TRACE && tstate->c_tracefunc)
2045 tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_RETURN, result);
2046 if (tstate->c_profilefunc)
2047 tstate->c_profilefunc(tstate->c_profileobj, frame, PyTrace_RETURN, result);
2048 CYTHON_FRAME_DEL(frame);
2049 __Pyx_LeaveTracing(tstate);
2050 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
2053 #define __Pyx_TraceReturn(result, nogil)\
2054 if (likely(!__Pyx_use_tracing)); else {\
2056 if (CYTHON_TRACE_NOGIL) {\
2057 PyThreadState *tstate;\
2058 PyGILState_STATE state = PyGILState_Ensure();\
2059 tstate = __Pyx_PyThreadState_Current;\
2060 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2061 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2063 PyGILState_Release(state);\
2066 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2067 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2068 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2073 #define __Pyx_TraceReturn(result, nogil)\
2074 if (likely(!__Pyx_use_tracing)); else {\
2075 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2076 if (__Pyx_IsTracing(tstate, 0, 0)) {\
2077 __Pyx_call_return_trace_func(tstate, __pyx_frame, (PyObject*)result);\
2081 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno);
2082 static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, PyThreadState* tstate,
const char *funcname,
const char *srcfile,
int firstlineno);
2084 #define __Pyx_TraceDeclarations
2085 #define __Pyx_TraceFrameInit(codeobj)
2086 #define __Pyx_TraceCall(funcname, srcfile, firstlineno, nogil, goto_error) if ((1)); else goto_error;
2087 #define __Pyx_TraceException()
2088 #define __Pyx_TraceReturn(result, nogil)
2091 static int __Pyx_call_line_trace_func(PyThreadState *tstate, PyFrameObject *frame,
int lineno) {
2093 PyObject *type, *value, *traceback;
2094 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
2095 __Pyx_PyFrame_SetLineNumber(frame, lineno);
2096 __Pyx_EnterTracing(tstate);
2097 ret = tstate->c_tracefunc(tstate->c_traceobj, frame, PyTrace_LINE, NULL);
2098 __Pyx_LeaveTracing(tstate);
2100 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
2104 Py_XDECREF(traceback);
2109 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2110 if (likely(!__Pyx_use_tracing)); else {\
2112 if (CYTHON_TRACE_NOGIL) {\
2114 PyThreadState *tstate;\
2115 PyGILState_STATE state = PyGILState_Ensure();\
2116 tstate = __Pyx_PyThreadState_Current;\
2117 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2118 ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2120 PyGILState_Release(state);\
2121 if (unlikely(ret)) goto_error;\
2124 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2125 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2126 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2127 if (unlikely(ret)) goto_error;\
2132 #define __Pyx_TraceLine(lineno, nogil, goto_error)\
2133 if (likely(!__Pyx_use_tracing)); else {\
2134 PyThreadState* tstate = __Pyx_PyThreadState_Current;\
2135 if (__Pyx_IsTracing(tstate, 0, 0) && tstate->c_tracefunc && __pyx_frame->f_trace) {\
2136 int ret = __Pyx_call_line_trace_func(tstate, __pyx_frame, lineno);\
2137 if (unlikely(ret)) goto_error;\
2142 #define __Pyx_TraceLine(lineno, nogil, goto_error) if ((1)); else goto_error;
2146 static void __Pyx_WriteUnraisable(
const char *name,
int clineno,
2147 int lineno,
const char *filename,
2148 int full_traceback,
int nogil);
2154 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals);
2157 #define __Pyx_BUF_MAX_NDIMS %(BUF_MAX_NDIMS)d
2158 #define __Pyx_MEMVIEW_DIRECT 1
2159 #define __Pyx_MEMVIEW_PTR 2
2160 #define __Pyx_MEMVIEW_FULL 4
2161 #define __Pyx_MEMVIEW_CONTIG 8
2162 #define __Pyx_MEMVIEW_STRIDED 16
2163 #define __Pyx_MEMVIEW_FOLLOW 32
2164 #define __Pyx_IS_C_CONTIG 1
2165 #define __Pyx_IS_F_CONTIG 2
2166 static int __Pyx_init_memviewslice(
2167 struct __pyx_memoryview_obj *memview,
2169 __Pyx_memviewslice *memviewslice,
2170 int memview_is_new_reference);
2171 static CYTHON_INLINE
int __pyx_add_acquisition_count_locked(
2172 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2173 static CYTHON_INLINE
int __pyx_sub_acquisition_count_locked(
2174 __pyx_atomic_int *acquisition_count, PyThread_type_lock lock);
2175 #define __pyx_get_slice_count_pointer(memview) (memview->acquisition_count_aligned_p)
2176 #define __pyx_get_slice_count(memview) (*__pyx_get_slice_count_pointer(memview))
2177 #define __PYX_INC_MEMVIEW(slice, have_gil) __Pyx_INC_MEMVIEW(slice, have_gil, __LINE__)
2178 #define __PYX_XDEC_MEMVIEW(slice, have_gil) __Pyx_XDEC_MEMVIEW(slice, have_gil, __LINE__)
2179 static CYTHON_INLINE
void __Pyx_INC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2180 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *,
int,
int);
2183 #if CYTHON_COMPILING_IN_CPYTHON
2184 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
2186 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
2190 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
2193 #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2194 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2195 __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
2196 (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
2197 __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
2198 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
2199 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
2200 int is_list,
int wraparound,
int boundscheck);
2203 static void __Pyx_RaiseArgtupleInvalid(
const char* func_name,
int exact,
2204 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
2207 static void __Pyx_RaiseDoubleKeywordsError(
const char* func_name, PyObject* kw_name);
2210 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
2211 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
2212 const char* function_name);
2215 #define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\
2216 ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\
2217 __Pyx__ArgTypeTest(obj, type, name, exact))
2218 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact);
2221 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
2222 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
2223 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
2224 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
2225 (version_var) = __PYX_GET_DICT_VERSION(dict);\
2226 (cache_var) = (value);
2227 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
2228 static PY_UINT64_T __pyx_dict_version = 0;\
2229 static PyObject *__pyx_dict_cached_value = NULL;\
2230 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
2231 (VAR) = __pyx_dict_cached_value;\
2233 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
2234 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
2237 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
2238 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
2239 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
2241 #define __PYX_GET_DICT_VERSION(dict) (0)
2242 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
2243 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
2247 #if CYTHON_USE_DICT_VERSIONS
2248 #define __Pyx_GetModuleGlobalName(var, name) do {\
2249 static PY_UINT64_T __pyx_dict_version = 0;\
2250 static PyObject *__pyx_dict_cached_value = NULL;\
2251 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
2252 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
2253 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2255 #define __Pyx_GetModuleGlobalNameUncached(var, name) do {\
2256 PY_UINT64_T __pyx_dict_version;\
2257 PyObject *__pyx_dict_cached_value;\
2258 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
2260 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
2262 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2263 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
2264 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
2268 #if CYTHON_FAST_PYCCALL
2269 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
2271 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
2275 #if CYTHON_FAST_PYCALL
2276 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
2277 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
2278 #if 1 || PY_VERSION_HEX < 0x030600B1
2279 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
2281 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
2283 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
2284 (sizeof(char [1 - 2*!(cond)]) - 1)
2285 #ifndef Py_MEMBER_SIZE
2286 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
2288 #if CYTHON_FAST_PYCALL
2289 static size_t __pyx_pyframe_localsplus_offset = 0;
2290 #include "frameobject.h"
2291 #if PY_VERSION_HEX >= 0x030b00a6
2292 #ifndef Py_BUILD_CORE
2293 #define Py_BUILD_CORE 1
2295 #include "internal/pycore_frame.h"
2297 #define __Pxy_PyFrame_Initialize_Offsets()\
2298 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
2299 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
2300 #define __Pyx_PyFrame_GetLocalsplus(frame)\
2301 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
2306 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2);
2309 #if CYTHON_COMPILING_IN_CPYTHON
2310 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
2314 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
2317 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals);
2320 #if PY_MAJOR_VERSION >= 3
2321 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
2323 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
2327 #define UNARY_NEG_WOULD_OVERFLOW(x)\
2328 (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x)))
2330 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2331 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *);
2333 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
2336 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2337 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2338 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
2339 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
2340 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
2341 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2342 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2343 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2344 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
2345 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
2346 int wraparound,
int boundscheck);
2347 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
2348 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
2349 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
2350 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
2351 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
2352 int wraparound,
int boundscheck);
2353 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
2354 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
2355 int is_list,
int wraparound,
int boundscheck);
2358 #if CYTHON_USE_TYPE_SLOTS
2359 static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key);
2361 #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key)
2365 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16(
const char *s, Py_ssize_t size,
const char *errors) {
2367 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2369 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16LE(
const char *s, Py_ssize_t size,
const char *errors) {
2371 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2373 static CYTHON_INLINE PyObject *__Pyx_PyUnicode_DecodeUTF16BE(
const char *s, Py_ssize_t size,
const char *errors) {
2375 return PyUnicode_DecodeUTF16(s, size, errors, &byteorder);
2379 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
2380 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
2381 const char* encoding,
const char* errors,
2382 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors));
2385 #if CYTHON_FAST_THREAD_STATE
2386 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
2387 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
2389 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
2393 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *);
2396 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
2399 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
2402 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void);
2405 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
2408 #if CYTHON_USE_EXC_INFO_STACK
2409 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
2413 #if CYTHON_FAST_THREAD_STATE
2414 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
2415 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2416 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
2417 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
2419 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
2420 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
2424 #if CYTHON_FAST_THREAD_STATE
2425 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
2426 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2428 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
2432 #if CYTHON_FAST_THREAD_STATE
2433 #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
2434 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
2436 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
2440 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level);
2443 #if CYTHON_COMPILING_IN_CPYTHON
2444 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2445 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2446 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2447 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2449 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2450 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2451 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2453 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2455 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
2457 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2458 static CYTHON_INLINE
int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
2459 PyListObject* L = (PyListObject*) list;
2460 Py_ssize_t len = Py_SIZE(list);
2461 if (likely(L->allocated > len)) {
2463 PyList_SET_ITEM(list, len, x);
2464 __Pyx_SET_SIZE(list, len + 1);
2467 return PyList_Append(list, x);
2470 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
2474 #if !CYTHON_COMPILING_IN_PYPY
2475 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2,
long intval,
int inplace,
int zerodivision_check);
2477 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace, zerodivision_check)\
2478 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
2482 static CYTHON_INLINE
int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
2483 #if CYTHON_COMPILING_IN_CPYTHON
2484 PyObject* none = _PyList_Extend((PyListObject*)L, v);
2485 if (unlikely(!none))
2490 return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
2495 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
2496 static CYTHON_INLINE
int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
2497 PyListObject* L = (PyListObject*) list;
2498 Py_ssize_t len = Py_SIZE(list);
2499 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
2501 PyList_SET_ITEM(list, len, x);
2502 __Pyx_SET_SIZE(list, len + 1);
2505 return PyList_Append(list, x);
2508 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
2512 #define __Pyx_init_assertions_enabled()
2513 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
2514 #define __pyx_assertions_enabled() (1)
2515 #elif PY_VERSION_HEX < 0x03080000 || CYTHON_COMPILING_IN_PYPY || defined(Py_LIMITED_API)
2516 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2517 #elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030900A6
2518 static int __pyx_assertions_enabled_flag;
2519 #define __pyx_assertions_enabled() (__pyx_assertions_enabled_flag)
2520 #undef __Pyx_init_assertions_enabled
2521 static void __Pyx_init_assertions_enabled(
void) {
2522 __pyx_assertions_enabled_flag = ! _PyInterpreterState_GetConfig(__Pyx_PyThreadState_Current->interp)->optimization_level;
2525 #define __pyx_assertions_enabled() (!Py_OptimizeFlag)
2529 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname);
2532 static CYTHON_INLINE
int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq,
int eq) {
2533 int result = PySequence_Contains(seq, item);
2534 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
2538 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
2541 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *, PyObject *);
2544 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2545 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
2547 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
2551 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
2552 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
2554 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
2558 static int __Pyx_SetVtable(PyObject *dict,
void *vtable);
2561 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
2564 static int __Pyx_setup_reduce(PyObject* type_obj);
2567 #ifndef __PYX_HAVE_RT_ImportType_proto_0_29_36
2568 #define __PYX_HAVE_RT_ImportType_proto_0_29_36
2569 #if __STDC_VERSION__ >= 201112L
2570 #include <stdalign.h>
2572 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201103L
2573 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_36(s) alignof(s)
2575 #define __PYX_GET_STRUCT_ALIGNMENT_0_29_36(s) sizeof(void*)
2577 enum __Pyx_ImportType_CheckSize_0_29_36 {
2578 __Pyx_ImportType_CheckSize_Error_0_29_36 = 0,
2579 __Pyx_ImportType_CheckSize_Warn_0_29_36 = 1,
2580 __Pyx_ImportType_CheckSize_Ignore_0_29_36 = 2
2582 static PyTypeObject *__Pyx_ImportType_0_29_36(PyObject* module,
const char *module_name,
const char *class_name,
size_t size,
size_t alignment,
enum __Pyx_ImportType_CheckSize_0_29_36 check_size);
2586 static void* __Pyx_GetVtable(PyObject *dict);
2589 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
2592 #define __Pyx_CyFunction_USED 1
2593 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
2594 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
2595 #define __Pyx_CYFUNCTION_CCLASS 0x04
2596 #define __Pyx_CyFunction_GetClosure(f)\
2597 (((__pyx_CyFunctionObject *) (f))->func_closure)
2598 #define __Pyx_CyFunction_GetClassObj(f)\
2599 (((__pyx_CyFunctionObject *) (f))->func_classobj)
2600 #define __Pyx_CyFunction_Defaults(type, f)\
2601 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
2602 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
2603 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
2605 PyCFunctionObject func;
2606 #if PY_VERSION_HEX < 0x030500A0
2607 PyObject *func_weakreflist;
2609 PyObject *func_dict;
2610 PyObject *func_name;
2611 PyObject *func_qualname;
2613 PyObject *func_globals;
2614 PyObject *func_code;
2615 PyObject *func_closure;
2616 PyObject *func_classobj;
2618 int defaults_pyobjects;
2619 size_t defaults_size;
2621 PyObject *defaults_tuple;
2622 PyObject *defaults_kwdict;
2623 PyObject *(*defaults_getter)(PyObject *);
2624 PyObject *func_annotations;
2625 } __pyx_CyFunctionObject;
2626 static PyTypeObject *__pyx_CyFunctionType = 0;
2627 #define __Pyx_CyFunction_Check(obj) (__Pyx_TypeCheck(obj, __pyx_CyFunctionType))
2628 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject* op, PyMethodDef *ml,
2629 int flags, PyObject* qualname,
2631 PyObject *module, PyObject *globals,
2633 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *m,
2636 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
2638 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
2640 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
2642 static int __pyx_CyFunction_init(
void);
2645 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
2646 int flags, PyObject* qualname,
2648 PyObject *module, PyObject *globals,
2652 #ifdef CYTHON_CLINE_IN_TRACEBACK
2653 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
2655 static int __Pyx_CLineForTraceback(PyThreadState *tstate,
int c_line);
2660 PyCodeObject* code_object;
2662 } __Pyx_CodeObjectCacheEntry;
2663 struct __Pyx_CodeObjectCache {
2666 __Pyx_CodeObjectCacheEntry* entries;
2668 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2669 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line);
2670 static PyCodeObject *__pyx_find_code_object(
int code_line);
2671 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object);
2674 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
2675 int py_line,
const char *filename);
2677 #if PY_MAJOR_VERSION < 3
2678 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags);
2679 static void __Pyx_ReleaseBuffer(Py_buffer *view);
2681 #define __Pyx_GetBuffer PyObject_GetBuffer
2682 #define __Pyx_ReleaseBuffer PyBuffer_Release
2688 Py_ssize_t shape, strides, suboffsets;
2689 } __Pyx_Buf_DimInfo;
2695 __Pyx_Buffer *rcbuffer;
2697 __Pyx_Buf_DimInfo diminfo[8];
2698 } __Pyx_LocalBuf_ND;
2701 static int __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim);
2704 static int __pyx_slices_overlap(__Pyx_memviewslice *slice1,
2705 __Pyx_memviewslice *slice2,
2706 int ndim,
size_t itemsize);
2709 static CYTHON_INLINE PyObject *__pyx_capsule_create(
void *p,
const char *sig);
2712 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
2713 #define __Pyx_HAS_GCC_DIAGNOSTIC
2717 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void);
2720 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts);
2721 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
2722 __Pyx_BufFmt_StackElem* stack,
2723 __Pyx_TypeInfo* type);
2726 static int __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b);
2729 static int __Pyx_ValidateAndInit_memviewslice(
2734 __Pyx_TypeInfo *dtype,
2735 __Pyx_BufFmt_StackElem stack[],
2736 __Pyx_memviewslice *memviewslice,
2737 PyObject *original_obj);
2740 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *,
int writable_flag);
2743 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *,
int writable_flag);
2746 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *,
int writable_flag);
2749 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *,
int writable_flag);
2752 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *,
int writable_flag);
2755 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(PyObject *,
int writable_flag);
2758 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(PyObject *,
int writable_flag);
2763 #define __Pyx_CREAL(z) ((z).real())
2764 #define __Pyx_CIMAG(z) ((z).imag())
2766 #define __Pyx_CREAL(z) (__real__(z))
2767 #define __Pyx_CIMAG(z) (__imag__(z))
2770 #define __Pyx_CREAL(z) ((z).real)
2771 #define __Pyx_CIMAG(z) ((z).imag)
2773 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
2774 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
2775 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
2776 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
2778 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
2779 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
2784 #define __Pyx_c_eq_float(a, b) ((a)==(b))
2785 #define __Pyx_c_sum_float(a, b) ((a)+(b))
2786 #define __Pyx_c_diff_float(a, b) ((a)-(b))
2787 #define __Pyx_c_prod_float(a, b) ((a)*(b))
2788 #define __Pyx_c_quot_float(a, b) ((a)/(b))
2789 #define __Pyx_c_neg_float(a) (-(a))
2791 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
2792 #define __Pyx_c_conj_float(z) (::std::conj(z))
2794 #define __Pyx_c_abs_float(z) (::std::abs(z))
2795 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
2798 #define __Pyx_c_is_zero_float(z) ((z)==0)
2799 #define __Pyx_c_conj_float(z) (conjf(z))
2801 #define __Pyx_c_abs_float(z) (cabsf(z))
2802 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
2806 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
2807 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
2808 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
2809 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
2810 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
2811 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
2812 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex);
2813 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
2815 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex);
2816 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
2822 #define __Pyx_c_eq_double(a, b) ((a)==(b))
2823 #define __Pyx_c_sum_double(a, b) ((a)+(b))
2824 #define __Pyx_c_diff_double(a, b) ((a)-(b))
2825 #define __Pyx_c_prod_double(a, b) ((a)*(b))
2826 #define __Pyx_c_quot_double(a, b) ((a)/(b))
2827 #define __Pyx_c_neg_double(a) (-(a))
2829 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
2830 #define __Pyx_c_conj_double(z) (::std::conj(z))
2832 #define __Pyx_c_abs_double(z) (::std::abs(z))
2833 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
2836 #define __Pyx_c_is_zero_double(z) ((z)==0)
2837 #define __Pyx_c_conj_double(z) (conj(z))
2839 #define __Pyx_c_abs_double(z) (cabs(z))
2840 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
2844 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
2845 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
2846 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
2847 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
2848 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
2849 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
2850 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex);
2851 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
2853 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex);
2854 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
2859 static __Pyx_memviewslice
2860 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
2861 const char *mode,
int ndim,
2862 size_t sizeof_dtype,
int contig_flag,
2863 int dtype_is_object);
2866 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *);
2869 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value);
2872 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value);
2875 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *);
2878 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *);
2881 static int __Pyx_check_binary_version(
void);
2884 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig);
2887 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig);
2890 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2892 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self);
2893 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
2894 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj);
2895 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src);
2896 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value);
2897 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
2898 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp);
2899 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2900 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp);
2901 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value);
2906 static PyTypeObject *__pyx_ptype_5imate_9functions_12py_functions_pyFunction = 0;
2915 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = 0;
2918 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = 0;
2921 static PyTypeObject *__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = 0;
2934 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc)(
char *,
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *,
int *);
2935 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_dstev)(
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *,
int *);
2936 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc)(
char *,
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *,
int *);
2937 static void (*__pyx_f_5scipy_6linalg_13cython_lapack_sstev)(
char *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *,
int *);
2940 static PyTypeObject *__pyx_array_type = 0;
2941 static PyTypeObject *__pyx_MemviewEnum_type = 0;
2942 static PyTypeObject *__pyx_memoryview_type = 0;
2943 static PyTypeObject *__pyx_memoryviewslice_type = 0;
2944 static PyObject *
generic = 0;
2945 static PyObject *strided = 0;
2946 static PyObject *indirect = 0;
2947 static PyObject *contiguous = 0;
2948 static PyObject *indirect_contiguous = 0;
2949 static int __pyx_memoryview_thread_locks_used;
2950 static PyThread_type_lock __pyx_memoryview_thread_locks[8];
2951 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *,
int __pyx_skip_dispatch);
2954 __PYX_EXTERN_C void lapack_sbdsdc(
char *,
char *,
int *,
float *,
float *,
float *,
int *,
float *,
int *,
float *,
int *,
float *,
int *,
int *);
2955 __PYX_EXTERN_C void lapack_dbdsdc(
char *,
char *,
int *,
double *,
double *,
double *,
int *,
double *,
int *,
double *,
int *,
double *,
int *,
int *);
2956 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *,
float const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
float const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
float const ,
float const ,
float const ,
float const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2957 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *,
double const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
double const ,
double const ,
double const ,
double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2958 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, __pyx_t_5imate_12_definitions_5types_IndexType
const ,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *,
long double const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_FlagType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
long double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __pyx_t_5imate_12_definitions_5types_IndexType
const ,
long double const ,
long double const ,
long double const ,
long double const , __pyx_t_5imate_12_definitions_5types_IndexType
const , __Pyx_memviewslice, __Pyx_memviewslice, __Pyx_memviewslice, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType,
float &);
2959 static struct __pyx_array_obj *__pyx_array_new(PyObject *, Py_ssize_t,
char *,
char *,
char *);
2960 static void *__pyx_align_pointer(
void *,
size_t);
2961 static PyObject *__pyx_memoryview_new(PyObject *,
int,
int, __Pyx_TypeInfo *);
2962 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *);
2963 static PyObject *_unellipsify(PyObject *,
int);
2964 static PyObject *assert_direct_dimensions(Py_ssize_t *,
int);
2965 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *, PyObject *);
2966 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int *, Py_ssize_t, Py_ssize_t, Py_ssize_t,
int,
int,
int,
int);
2967 static char *__pyx_pybuffer_index(Py_buffer *,
char *, Py_ssize_t, Py_ssize_t);
2968 static int __pyx_memslice_transpose(__Pyx_memviewslice *);
2969 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice,
int, PyObject *(*)(
char *),
int (*)(
char *, PyObject *),
int);
2970 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2971 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2972 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *);
2973 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *, __Pyx_memviewslice *);
2974 static Py_ssize_t abs_py_ssize_t(Py_ssize_t);
2975 static char __pyx_get_best_slice_order(__Pyx_memviewslice *,
int);
2976 static void _copy_strided_to_strided(
char *, Py_ssize_t *,
char *, Py_ssize_t *, Py_ssize_t *, Py_ssize_t *,
int,
size_t);
2977 static void copy_strided_to_strided(__Pyx_memviewslice *, __Pyx_memviewslice *,
int,
size_t);
2978 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *,
int);
2979 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *, Py_ssize_t *, Py_ssize_t,
int,
char);
2980 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *, __Pyx_memviewslice *,
char,
int);
2981 static int __pyx_memoryview_err_extents(
int, Py_ssize_t, Py_ssize_t);
2982 static int __pyx_memoryview_err_dim(PyObject *,
char *,
int);
2983 static int __pyx_memoryview_err(PyObject *,
char *);
2984 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice, __Pyx_memviewslice,
int,
int,
int);
2985 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *,
int,
int);
2986 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *,
int,
int,
int);
2987 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2988 static void __pyx_memoryview_refcount_objects_in_slice(
char *, Py_ssize_t *, Py_ssize_t *,
int,
int);
2989 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *,
int,
size_t,
void *,
int);
2990 static void __pyx_memoryview__slice_assign_scalar(
char *, Py_ssize_t *, Py_ssize_t *,
int,
size_t,
void *);
2991 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *, PyObject *);
2992 static __Pyx_TypeInfo __Pyx_TypeInfo_float = {
"float", NULL,
sizeof(float), { 0 }, 0,
'R', 0, 0 };
2993 static __Pyx_TypeInfo __Pyx_TypeInfo_int = {
"int", NULL,
sizeof(int), { 0 }, 0, IS_UNSIGNED(
int) ?
'U' :
'I', IS_UNSIGNED(
int), 0 };
2994 static __Pyx_TypeInfo __Pyx_TypeInfo_double = {
"double", NULL,
sizeof(double), { 0 }, 0,
'R', 0, 0 };
2995 static __Pyx_TypeInfo __Pyx_TypeInfo_long__double = {
"long double", NULL,
sizeof(
long double), { 0 }, 0,
'R', 0, 0 };
2996 #define __Pyx_MODULE_NAME "imate._c_trace_estimator.py_c_trace_estimator"
2997 extern int __pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator;
2998 int __pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator = 0;
3001 static PyObject *__pyx_builtin_TypeError;
3002 static PyObject *__pyx_builtin_range;
3003 static PyObject *__pyx_builtin_ValueError;
3004 static PyObject *__pyx_builtin_MemoryError;
3005 static PyObject *__pyx_builtin_enumerate;
3006 static PyObject *__pyx_builtin_Ellipsis;
3007 static PyObject *__pyx_builtin_id;
3008 static PyObject *__pyx_builtin_IndexError;
3009 static const char __pyx_k_O[] =
"O";
3010 static const char __pyx_k_c[] =
"c";
3011 static const char __pyx_k_id[] =
"id";
3012 static const char __pyx_k_Aop[] =
"Aop";
3013 static const char __pyx_k_new[] =
"__new__";
3014 static const char __pyx_k_obj[] =
"obj";
3015 static const char __pyx_k_base[] =
"base";
3016 static const char __pyx_k_dict[] =
"__dict__";
3017 static const char __pyx_k_main[] =
"__main__";
3018 static const char __pyx_k_mode[] =
"mode";
3019 static const char __pyx_k_name[] =
"name";
3020 static const char __pyx_k_ndim[] =
"ndim";
3021 static const char __pyx_k_pack[] =
"pack";
3022 static const char __pyx_k_size[] =
"size";
3023 static const char __pyx_k_step[] =
"step";
3024 static const char __pyx_k_stop[] =
"stop";
3025 static const char __pyx_k_test[] =
"__test__";
3026 static const char __pyx_k_ASCII[] =
"ASCII";
3027 static const char __pyx_k_class[] =
"__class__";
3028 static const char __pyx_k_error[] =
"error";
3029 static const char __pyx_k_flags[] =
"flags";
3030 static const char __pyx_k_numpy[] =
"numpy";
3031 static const char __pyx_k_range[] =
"range";
3032 static const char __pyx_k_shape[] =
"shape";
3033 static const char __pyx_k_start[] =
"start";
3034 static const char __pyx_k_trace[] =
"trace";
3035 static const char __pyx_k_encode[] =
"encode";
3036 static const char __pyx_k_format[] =
"format";
3037 static const char __pyx_k_import[] =
"__import__";
3038 static const char __pyx_k_name_2[] =
"__name__";
3039 static const char __pyx_k_pickle[] =
"pickle";
3040 static const char __pyx_k_reduce[] =
"__reduce__";
3041 static const char __pyx_k_struct[] =
"struct";
3042 static const char __pyx_k_unpack[] =
"unpack";
3043 static const char __pyx_k_update[] =
"update";
3044 static const char __pyx_k_float32[] =
"float32";
3045 static const char __pyx_k_float64[] =
"float64";
3046 static const char __pyx_k_fortran[] =
"fortran";
3047 static const char __pyx_k_memview[] =
"memview";
3048 static const char __pyx_k_samples[] =
"samples";
3049 static const char __pyx_k_Ellipsis[] =
"Ellipsis";
3050 static const char __pyx_k_exponent[] =
"exponent";
3051 static const char __pyx_k_float128[] =
"float128";
3052 static const char __pyx_k_getstate[] =
"__getstate__";
3053 static const char __pyx_k_isscalar[] =
"isscalar";
3054 static const char __pyx_k_itemsize[] =
"itemsize";
3055 static const char __pyx_k_pyx_type[] =
"__pyx_type";
3056 static const char __pyx_k_setstate[] =
"__setstate__";
3057 static const char __pyx_k_TypeError[] =
"TypeError";
3058 static const char __pyx_k_converged[] =
"converged";
3059 static const char __pyx_k_enumerate[] =
"enumerate";
3060 static const char __pyx_k_pyx_state[] =
"__pyx_state";
3061 static const char __pyx_k_reduce_ex[] =
"__reduce_ex__";
3062 static const char __pyx_k_symmetric[] =
"symmetric";
3063 static const char __pyx_k_IndexError[] =
"IndexError";
3064 static const char __pyx_k_ValueError[] =
"ValueError";
3065 static const char __pyx_k_error_atol[] =
"error_atol";
3066 static const char __pyx_k_error_rtol[] =
"error_rtol";
3067 static const char __pyx_k_parameters[] =
"parameters";
3068 static const char __pyx_k_pyx_result[] =
"__pyx_result";
3069 static const char __pyx_k_pyx_vtable[] =
"__pyx_vtable__";
3070 static const char __pyx_k_MemoryError[] =
"MemoryError";
3071 static const char __pyx_k_PickleError[] =
"PickleError";
3072 static const char __pyx_k_lanczos_tol[] =
"lanczos_tol";
3073 static const char __pyx_k_num_threads[] =
"num_threads";
3074 static const char __pyx_k_num_outliers[] =
"num_outliers";
3075 static const char __pyx_k_pyx_checksum[] =
"__pyx_checksum";
3076 static const char __pyx_k_stringsource[] =
"stringsource";
3077 static const char __pyx_k_num_inquiries[] =
"num_inquiries";
3078 static const char __pyx_k_pyx_getbuffer[] =
"__pyx_getbuffer";
3079 static const char __pyx_k_reduce_cython[] =
"__reduce_cython__";
3080 static const char __pyx_k_alg_wall_times[] =
"alg_wall_times";
3081 static const char __pyx_k_data_type_name[] =
"data_type_name";
3082 static const char __pyx_k_lanczos_degree[] =
"lanczos_degree";
3083 static const char __pyx_k_View_MemoryView[] =
"View.MemoryView";
3084 static const char __pyx_k_allocate_buffer[] =
"allocate_buffer";
3085 static const char __pyx_k_dtype_is_object[] =
"dtype_is_object";
3086 static const char __pyx_k_max_num_samples[] =
"max_num_samples";
3087 static const char __pyx_k_min_num_samples[] =
"min_num_samples";
3088 static const char __pyx_k_pyx_PickleError[] =
"__pyx_PickleError";
3089 static const char __pyx_k_reorthogonalize[] =
"reorthogonalize";
3090 static const char __pyx_k_setstate_cython[] =
"__setstate_cython__";
3091 static const char __pyx_k_confidence_level[] =
"confidence_level";
3092 static const char __pyx_k_num_samples_used[] =
"num_samples_used";
3093 static const char __pyx_k_pyx_unpickle_Enum[] =
"__pyx_unpickle_Enum";
3094 static const char __pyx_k_cline_in_traceback[] =
"cline_in_traceback";
3095 static const char __pyx_k_py_matrix_function[] =
"py_matrix_function";
3096 static const char __pyx_k_strided_and_direct[] =
"<strided and direct>";
3097 static const char __pyx_k_pyc_trace_estimator[] =
"pyc_trace_estimator";
3098 static const char __pyx_k_strided_and_indirect[] =
"<strided and indirect>";
3099 static const char __pyx_k_contiguous_and_direct[] =
"<contiguous and direct>";
3100 static const char __pyx_k_MemoryView_of_r_object[] =
"<MemoryView of %r object>";
3101 static const char __pyx_k_MemoryView_of_r_at_0x_x[] =
"<MemoryView of %r at 0x%x>";
3102 static const char __pyx_k_contiguous_and_indirect[] =
"<contiguous and indirect>";
3103 static const char __pyx_k_Cannot_index_with_type_s[] =
"Cannot index with type '%s'";
3104 static const char __pyx_k_Invalid_shape_in_axis_d_d[] =
"Invalid shape in axis %d: %d.";
3105 static const char __pyx_k_processed_samples_indices[] =
"processed_samples_indices";
3106 static const char __pyx_k_outlier_significance_level[] =
"outlier_significance_level";
3107 static const char __pyx_k_itemsize_0_for_cython_array[] =
"itemsize <= 0 for cython.array";
3108 static const char __pyx_k_unable_to_allocate_array_data[] =
"unable to allocate array data.";
3109 static const char __pyx_k_strided_and_direct_or_indirect[] =
"<strided and direct or indirect>";
3110 static const char __pyx_k_Buffer_view_does_not_expose_stri[] =
"Buffer view does not expose strides";
3111 static const char __pyx_k_Can_only_create_a_buffer_that_is[] =
"Can only create a buffer that is contiguous in memory.";
3112 static const char __pyx_k_Cannot_assign_to_read_only_memor[] =
"Cannot assign to read-only memoryview";
3113 static const char __pyx_k_Cannot_create_writable_memory_vi[] =
"Cannot create writable memory view from read-only memoryview";
3114 static const char __pyx_k_Data_type_should_be_float32_floa[] =
"Data type should be \"float32\", \"float64\", or \"float128\".";
3115 static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] =
"Empty shape tuple for cython.array";
3116 static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] =
"Incompatible checksums (0x%x vs (0xb068931, 0x82a3537, 0x6ae9995) = (name))";
3117 static const char __pyx_k_Indirect_dimensions_not_supporte[] =
"Indirect dimensions not supported";
3118 static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] =
"Invalid mode, expected 'c' or 'fortran', got %s";
3119 static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] =
"Out of bounds on buffer access (axis %d)";
3120 static const char __pyx_k_Unable_to_convert_item_to_object[] =
"Unable to convert item to object";
3121 static const char __pyx_k_got_differing_extents_in_dimensi[] =
"got differing extents in dimension %d (got %d and %d)";
3122 static const char __pyx_k_imate__c_trace_estimator_py_c_tr[] =
"imate/_c_trace_estimator/py_c_trace_estimator.pyx";
3123 static const char __pyx_k_no_default___reduce___due_to_non[] =
"no default __reduce__ due to non-trivial __cinit__";
3124 static const char __pyx_k_unable_to_allocate_shape_and_str[] =
"unable to allocate shape and strides.";
3125 static const char __pyx_k_imate__c_trace_estimator_py_c_tr_2[] =
"imate._c_trace_estimator.py_c_trace_estimator";
3126 static PyObject *__pyx_n_s_ASCII;
3127 static PyObject *__pyx_n_s_Aop;
3128 static PyObject *__pyx_kp_s_Buffer_view_does_not_expose_stri;
3129 static PyObject *__pyx_kp_s_Can_only_create_a_buffer_that_is;
3130 static PyObject *__pyx_kp_s_Cannot_assign_to_read_only_memor;
3131 static PyObject *__pyx_kp_s_Cannot_create_writable_memory_vi;
3132 static PyObject *__pyx_kp_s_Cannot_index_with_type_s;
3133 static PyObject *__pyx_kp_u_Data_type_should_be_float32_floa;
3134 static PyObject *__pyx_n_s_Ellipsis;
3135 static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr;
3136 static PyObject *__pyx_kp_s_Incompatible_checksums_0x_x_vs_0;
3137 static PyObject *__pyx_n_s_IndexError;
3138 static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte;
3139 static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr;
3140 static PyObject *__pyx_kp_s_Invalid_shape_in_axis_d_d;
3141 static PyObject *__pyx_n_s_MemoryError;
3142 static PyObject *__pyx_kp_s_MemoryView_of_r_at_0x_x;
3143 static PyObject *__pyx_kp_s_MemoryView_of_r_object;
3144 static PyObject *__pyx_n_b_O;
3145 static PyObject *__pyx_kp_s_Out_of_bounds_on_buffer_access_a;
3146 static PyObject *__pyx_n_s_PickleError;
3147 static PyObject *__pyx_n_s_TypeError;
3148 static PyObject *__pyx_kp_s_Unable_to_convert_item_to_object;
3149 static PyObject *__pyx_n_s_ValueError;
3150 static PyObject *__pyx_n_s_View_MemoryView;
3151 static PyObject *__pyx_n_s_alg_wall_times;
3152 static PyObject *__pyx_n_s_allocate_buffer;
3153 static PyObject *__pyx_n_s_base;
3154 static PyObject *__pyx_n_s_c;
3155 static PyObject *__pyx_n_u_c;
3156 static PyObject *__pyx_n_s_class;
3157 static PyObject *__pyx_n_s_cline_in_traceback;
3158 static PyObject *__pyx_n_s_confidence_level;
3159 static PyObject *__pyx_kp_s_contiguous_and_direct;
3160 static PyObject *__pyx_kp_s_contiguous_and_indirect;
3161 static PyObject *__pyx_n_s_converged;
3162 static PyObject *__pyx_n_s_data_type_name;
3163 static PyObject *__pyx_n_s_dict;
3164 static PyObject *__pyx_n_s_dtype_is_object;
3165 static PyObject *__pyx_n_s_encode;
3166 static PyObject *__pyx_n_s_enumerate;
3167 static PyObject *__pyx_n_s_error;
3168 static PyObject *__pyx_n_s_error_atol;
3169 static PyObject *__pyx_n_s_error_rtol;
3170 static PyObject *__pyx_n_s_exponent;
3171 static PyObject *__pyx_n_s_flags;
3172 static PyObject *__pyx_n_b_float128;
3173 static PyObject *__pyx_n_b_float32;
3174 static PyObject *__pyx_n_b_float64;
3175 static PyObject *__pyx_n_s_format;
3176 static PyObject *__pyx_n_s_fortran;
3177 static PyObject *__pyx_n_u_fortran;
3178 static PyObject *__pyx_n_s_getstate;
3179 static PyObject *__pyx_kp_s_got_differing_extents_in_dimensi;
3180 static PyObject *__pyx_n_s_id;
3181 static PyObject *__pyx_kp_s_imate__c_trace_estimator_py_c_tr;
3182 static PyObject *__pyx_n_s_imate__c_trace_estimator_py_c_tr_2;
3183 static PyObject *__pyx_n_s_import;
3184 static PyObject *__pyx_n_s_isscalar;
3185 static PyObject *__pyx_n_s_itemsize;
3186 static PyObject *__pyx_kp_s_itemsize_0_for_cython_array;
3187 static PyObject *__pyx_n_s_lanczos_degree;
3188 static PyObject *__pyx_n_s_lanczos_tol;
3189 static PyObject *__pyx_n_s_main;
3190 static PyObject *__pyx_n_s_max_num_samples;
3191 static PyObject *__pyx_n_s_memview;
3192 static PyObject *__pyx_n_s_min_num_samples;
3193 static PyObject *__pyx_n_s_mode;
3194 static PyObject *__pyx_n_s_name;
3195 static PyObject *__pyx_n_s_name_2;
3196 static PyObject *__pyx_n_s_ndim;
3197 static PyObject *__pyx_n_s_new;
3198 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
3199 static PyObject *__pyx_n_s_num_inquiries;
3200 static PyObject *__pyx_n_s_num_outliers;
3201 static PyObject *__pyx_n_s_num_samples_used;
3202 static PyObject *__pyx_n_s_num_threads;
3203 static PyObject *__pyx_n_s_numpy;
3204 static PyObject *__pyx_n_s_obj;
3205 static PyObject *__pyx_n_s_outlier_significance_level;
3206 static PyObject *__pyx_n_s_pack;
3207 static PyObject *__pyx_n_s_parameters;
3208 static PyObject *__pyx_n_s_pickle;
3209 static PyObject *__pyx_n_s_processed_samples_indices;
3210 static PyObject *__pyx_n_s_py_matrix_function;
3211 static PyObject *__pyx_n_s_pyc_trace_estimator;
3212 static PyObject *__pyx_n_s_pyx_PickleError;
3213 static PyObject *__pyx_n_s_pyx_checksum;
3214 static PyObject *__pyx_n_s_pyx_getbuffer;
3215 static PyObject *__pyx_n_s_pyx_result;
3216 static PyObject *__pyx_n_s_pyx_state;
3217 static PyObject *__pyx_n_s_pyx_type;
3218 static PyObject *__pyx_n_s_pyx_unpickle_Enum;
3219 static PyObject *__pyx_n_s_pyx_vtable;
3220 static PyObject *__pyx_n_s_range;
3221 static PyObject *__pyx_n_s_reduce;
3222 static PyObject *__pyx_n_s_reduce_cython;
3223 static PyObject *__pyx_n_s_reduce_ex;
3224 static PyObject *__pyx_n_s_reorthogonalize;
3225 static PyObject *__pyx_n_s_samples;
3226 static PyObject *__pyx_n_s_setstate;
3227 static PyObject *__pyx_n_s_setstate_cython;
3228 static PyObject *__pyx_n_s_shape;
3229 static PyObject *__pyx_n_s_size;
3230 static PyObject *__pyx_n_s_start;
3231 static PyObject *__pyx_n_s_step;
3232 static PyObject *__pyx_n_s_stop;
3233 static PyObject *__pyx_kp_s_strided_and_direct;
3234 static PyObject *__pyx_kp_s_strided_and_direct_or_indirect;
3235 static PyObject *__pyx_kp_s_strided_and_indirect;
3236 static PyObject *__pyx_kp_s_stringsource;
3237 static PyObject *__pyx_n_s_struct;
3238 static PyObject *__pyx_n_s_symmetric;
3239 static PyObject *__pyx_n_s_test;
3240 static PyObject *__pyx_n_s_trace;
3241 static PyObject *__pyx_kp_s_unable_to_allocate_array_data;
3242 static PyObject *__pyx_kp_s_unable_to_allocate_shape_and_str;
3243 static PyObject *__pyx_n_s_unpack;
3244 static PyObject *__pyx_n_s_update;
3245 static PyObject *__pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(CYTHON_UNUSED PyObject *__pyx_self,
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_exponent, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times);
3246 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer);
3247 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
3248 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self);
3249 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self);
3250 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self);
3251 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr);
3252 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item);
3253 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
3254 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self);
3255 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3256 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name);
3257 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
3258 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self);
3259 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state);
3260 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object);
3261 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self);
3262 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index);
3263 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
3264 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
3265 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3266 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3267 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3268 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3269 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3270 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3271 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3272 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3273 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self);
3274 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self);
3275 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self);
3276 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self);
3277 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
3278 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self);
3279 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self);
3280 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self);
3281 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self);
3282 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3283 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3284 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3285 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self);
3286 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state);
3287 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state);
3288 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k);
3289 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, PyObject *a, PyObject *k);
3290 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k);
3291 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k);
3292 static PyObject *__pyx_int_0;
3293 static PyObject *__pyx_int_1;
3294 static PyObject *__pyx_int_112105877;
3295 static PyObject *__pyx_int_136983863;
3296 static PyObject *__pyx_int_184977713;
3297 static PyObject *__pyx_int_neg_1;
3298 static PyObject *__pyx_codeobj_;
3299 static PyObject *__pyx_tuple__2;
3300 static PyObject *__pyx_tuple__3;
3301 static PyObject *__pyx_tuple__4;
3302 static PyObject *__pyx_tuple__5;
3303 static PyObject *__pyx_tuple__6;
3304 static PyObject *__pyx_tuple__7;
3305 static PyObject *__pyx_tuple__8;
3306 static PyObject *__pyx_tuple__9;
3307 static PyObject *__pyx_slice__17;
3308 static PyObject *__pyx_tuple__10;
3309 static PyObject *__pyx_tuple__11;
3310 static PyObject *__pyx_tuple__12;
3311 static PyObject *__pyx_tuple__13;
3312 static PyObject *__pyx_tuple__14;
3313 static PyObject *__pyx_tuple__15;
3314 static PyObject *__pyx_tuple__16;
3315 static PyObject *__pyx_tuple__18;
3316 static PyObject *__pyx_tuple__19;
3317 static PyObject *__pyx_tuple__20;
3318 static PyObject *__pyx_tuple__22;
3319 static PyObject *__pyx_tuple__23;
3320 static PyObject *__pyx_tuple__24;
3321 static PyObject *__pyx_tuple__25;
3322 static PyObject *__pyx_tuple__26;
3323 static PyObject *__pyx_tuple__27;
3324 static PyObject *__pyx_tuple__28;
3325 static PyObject *__pyx_tuple__29;
3326 static PyObject *__pyx_codeobj__21;
3337 void lapack_sstev(
char *__pyx_v_jobz,
int *__pyx_v_n,
float *__pyx_v_d,
float *__pyx_v_e,
float *__pyx_v_z,
int *__pyx_v_ldz,
float *__pyx_v_work,
int *__pyx_v_info) {
3338 __Pyx_TraceDeclarations
3339 int __pyx_lineno = 0;
3340 const char *__pyx_filename = NULL;
3341 int __pyx_clineno = 0;
3342 __Pyx_TraceCall(
"lapack_sstev", __pyx_f[1], 21, 1, __PYX_ERR(1, 21, __pyx_L1_error));
3351 __Pyx_TraceLine(34,1,__PYX_ERR(1, 34, __pyx_L1_error))
3352 __pyx_f_5scipy_6linalg_13cython_lapack_sstev(__pyx_v_jobz, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_z, __pyx_v_ldz, __pyx_v_work, __pyx_v_info);
3365 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_sstev", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3367 __Pyx_TraceReturn(Py_None, 1);
3378 void lapack_dstev(
char *__pyx_v_jobz,
int *__pyx_v_n,
double *__pyx_v_d,
double *__pyx_v_e,
double *__pyx_v_z,
int *__pyx_v_ldz,
double *__pyx_v_work,
int *__pyx_v_info) {
3379 __Pyx_TraceDeclarations
3380 int __pyx_lineno = 0;
3381 const char *__pyx_filename = NULL;
3382 int __pyx_clineno = 0;
3383 __Pyx_TraceCall(
"lapack_dstev", __pyx_f[1], 41, 1, __PYX_ERR(1, 41, __pyx_L1_error));
3392 __Pyx_TraceLine(55,1,__PYX_ERR(1, 55, __pyx_L1_error))
3393 __pyx_f_5scipy_6linalg_13cython_lapack_dstev(__pyx_v_jobz, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_z, __pyx_v_ldz, __pyx_v_work, __pyx_v_info);
3406 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_dstev", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3408 __Pyx_TraceReturn(Py_None, 1);
3419 void lapack_sbdsdc(
char *__pyx_v_uplo,
char *__pyx_v_compq,
int *__pyx_v_n,
float *__pyx_v_d,
float *__pyx_v_e,
float *__pyx_v_u,
int *__pyx_v_ldu,
float *__pyx_v_vt,
int *__pyx_v_ldvt,
float *__pyx_v_q,
int *__pyx_v_iq,
float *__pyx_v_work,
int *__pyx_v_iwork,
int *__pyx_v_info) {
3420 __Pyx_TraceDeclarations
3421 int __pyx_lineno = 0;
3422 const char *__pyx_filename = NULL;
3423 int __pyx_clineno = 0;
3424 __Pyx_TraceCall(
"lapack_sbdsdc", __pyx_f[1], 62, 1, __PYX_ERR(1, 62, __pyx_L1_error));
3433 __Pyx_TraceLine(77,1,__PYX_ERR(1, 77, __pyx_L1_error))
3434 __pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc(__pyx_v_uplo, __pyx_v_compq, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_u, __pyx_v_ldu, __pyx_v_vt, __pyx_v_ldvt, __pyx_v_q, __pyx_v_iq, __pyx_v_work, __pyx_v_iwork, __pyx_v_info);
3447 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_sbdsdc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3449 __Pyx_TraceReturn(Py_None, 1);
3460 void lapack_dbdsdc(
char *__pyx_v_uplo,
char *__pyx_v_compq,
int *__pyx_v_n,
double *__pyx_v_d,
double *__pyx_v_e,
double *__pyx_v_u,
int *__pyx_v_ldu,
double *__pyx_v_vt,
int *__pyx_v_ldvt,
double *__pyx_v_q,
int *__pyx_v_iq,
double *__pyx_v_work,
int *__pyx_v_iwork,
int *__pyx_v_info) {
3461 __Pyx_TraceDeclarations
3462 int __pyx_lineno = 0;
3463 const char *__pyx_filename = NULL;
3464 int __pyx_clineno = 0;
3465 __Pyx_TraceCall(
"lapack_dbdsdc", __pyx_f[1], 84, 1, __PYX_ERR(1, 84, __pyx_L1_error));
3472 __Pyx_TraceLine(99,1,__PYX_ERR(1, 99, __pyx_L1_error))
3473 __pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc(__pyx_v_uplo, __pyx_v_compq, __pyx_v_n, __pyx_v_d, __pyx_v_e, __pyx_v_u, __pyx_v_ldu, __pyx_v_vt, __pyx_v_ldvt, __pyx_v_q, __pyx_v_iq, __pyx_v_work, __pyx_v_iwork, __pyx_v_info);
3486 __Pyx_WriteUnraisable(
"imate._c_trace_estimator.py_c_trace_estimator.lapack_dbdsdc", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
3488 __Pyx_TraceReturn(Py_None, 1);
3499 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
3500 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_exponent, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times, CYTHON_UNUSED
int __pyx_skip_dispatch) {
3501 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
3502 float __pyx_v_alg_wall_time;
3503 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
3504 __Pyx_TraceDeclarations
3505 __Pyx_RefNannyDeclarations
3507 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_2;
3509 PyObject *__pyx_t_4 = NULL;
3510 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_5;
3511 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_6;
3512 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_7;
3514 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
3515 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
3520 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_15;
3521 __Pyx_memviewslice __pyx_t_16 = { 0, 0, { 0 }, { 0 }, { 0 } };
3522 __Pyx_memviewslice __pyx_t_17 = { 0, 0, { 0 }, { 0 }, { 0 } };
3523 __Pyx_memviewslice __pyx_t_18 = { 0, 0, { 0 }, { 0 }, { 0 } };
3524 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_19 = { 0, 0, { 0 }, { 0 }, { 0 } };
3525 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_20 = { 0, 0, { 0 }, { 0 }, { 0 } };
3526 __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_t_21 = { 0, 0, { 0 }, { 0 }, { 0 } };
3527 __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_t_22 = { 0, 0, { 0 }, { 0 }, { 0 } };
3528 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_23;
3535 __Pyx_memviewslice __pyx_t_30 = { 0, 0, { 0 }, { 0 }, { 0 } };
3536 __Pyx_memviewslice __pyx_t_31 = { 0, 0, { 0 }, { 0 }, { 0 } };
3537 __Pyx_memviewslice __pyx_t_32 = { 0, 0, { 0 }, { 0 }, { 0 } };
3538 long double __pyx_t_33;
3539 long double __pyx_t_34;
3540 long double __pyx_t_35;
3541 long double __pyx_t_36;
3542 long double __pyx_t_37;
3543 long double __pyx_t_38;
3544 __Pyx_memviewslice __pyx_t_39 = { 0, 0, { 0 }, { 0 }, { 0 } };
3545 __Pyx_memviewslice __pyx_t_40 = { 0, 0, { 0 }, { 0 }, { 0 } };
3546 __Pyx_memviewslice __pyx_t_41 = { 0, 0, { 0 }, { 0 }, { 0 } };
3547 int __pyx_lineno = 0;
3548 const char *__pyx_filename = NULL;
3549 int __pyx_clineno = 0;
3550 __Pyx_TraceFrameInit(__pyx_codeobj_)
3551 __Pyx_RefNannySetupContext(
"pyc_trace_estimator", 0);
3552 __Pyx_TraceCall(
"pyc_trace_estimator", __pyx_f[0], 38, 0, __PYX_ERR(0, 38, __pyx_L1_error));
3561 __Pyx_TraceLine(67,0,__PYX_ERR(0, 67, __pyx_L1_error))
3562 __pyx_v_all_converged = 0;
3571 __Pyx_TraceLine(68,0,__PYX_ERR(0, 68, __pyx_L1_error))
3572 __pyx_v_alg_wall_time = 0.0;
3581 __Pyx_TraceLine(70,0,__PYX_ERR(0, 70, __pyx_L1_error))
3582 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float32, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 70, __pyx_L1_error)
3592 __Pyx_TraceLine(75,0,__PYX_ERR(0, 75, __pyx_L1_error))
3593 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 75, __pyx_L1_error)
3602 __Pyx_TraceLine(77,0,__PYX_ERR(0, 77, __pyx_L1_error))
3603 __pyx_t_3 = __pyx_PyFloat_AsFloat(__pyx_v_exponent);
if (unlikely((__pyx_t_3 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error)
3612 __Pyx_TraceLine(78,0,__PYX_ERR(0, 78, __pyx_L1_error))
3613 __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_symmetric);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error)
3614 __Pyx_GOTREF(__pyx_t_4);
3615 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error)
3616 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3625 __Pyx_TraceLine(79,0,__PYX_ERR(0, 79, __pyx_L1_error))
3626 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 79, __pyx_L1_error)
3635 __Pyx_TraceLine(80,0,__PYX_ERR(0, 80, __pyx_L1_error))
3636 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error)
3645 __Pyx_TraceLine(81,0,__PYX_ERR(0, 81, __pyx_L1_error))
3646 __pyx_t_8 = __pyx_PyFloat_AsFloat(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_8 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error)
3655 __Pyx_TraceLine(82,0,__PYX_ERR(0, 82, __pyx_L1_error))
3656 __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_9 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 82, __pyx_L1_error)
3665 __Pyx_TraceLine(83,0,__PYX_ERR(0, 83, __pyx_L1_error))
3666 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error)
3675 __Pyx_TraceLine(84,0,__PYX_ERR(0, 84, __pyx_L1_error))
3676 __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_error_atol);
if (unlikely((__pyx_t_11 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
3685 __Pyx_TraceLine(85,0,__PYX_ERR(0, 85, __pyx_L1_error))
3686 __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_error_rtol);
if (unlikely((__pyx_t_12 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
3695 __Pyx_TraceLine(86,0,__PYX_ERR(0, 86, __pyx_L1_error))
3696 __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_confidence_level);
if (unlikely((__pyx_t_13 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
3705 __Pyx_TraceLine(87,0,__PYX_ERR(0, 87, __pyx_L1_error))
3706 __pyx_t_14 = __pyx_PyFloat_AsFloat(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_14 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
3715 __Pyx_TraceLine(88,0,__PYX_ERR(0, 88, __pyx_L1_error))
3716 __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_15 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error)
3725 __Pyx_TraceLine(89,0,__PYX_ERR(0, 89, __pyx_L1_error))
3726 __pyx_t_16 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_16.memview)) __PYX_ERR(0, 89, __pyx_L1_error)
3735 __Pyx_TraceLine(90,0,__PYX_ERR(0, 90, __pyx_L1_error))
3736 __pyx_t_17 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_17.memview)) __PYX_ERR(0, 90, __pyx_L1_error)
3745 __Pyx_TraceLine(91,0,__PYX_ERR(0, 91, __pyx_L1_error))
3746 __pyx_t_18 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_18.memview)) __PYX_ERR(0, 91, __pyx_L1_error)
3755 __Pyx_TraceLine(92,0,__PYX_ERR(0, 92, __pyx_L1_error))
3756 __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 92, __pyx_L1_error)
3765 __Pyx_TraceLine(93,0,__PYX_ERR(0, 93, __pyx_L1_error))
3766 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 93, __pyx_L1_error)
3775 __Pyx_TraceLine(94,0,__PYX_ERR(0, 94, __pyx_L1_error))
3776 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 94, __pyx_L1_error)
3785 __Pyx_TraceLine(95,0,__PYX_ERR(0, 95, __pyx_L1_error))
3786 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 95, __pyx_L1_error)
3795 __Pyx_TraceLine(72,0,__PYX_ERR(0, 72, __pyx_L1_error))
3796 __pyx_t_23 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_2, __pyx_v_py_matrix_function, __pyx_t_3, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_23 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 72, __pyx_L1_error)
3797 __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
3798 __pyx_t_16.memview = NULL;
3799 __pyx_t_16.data = NULL;
3800 __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
3801 __pyx_t_17.memview = NULL;
3802 __pyx_t_17.data = NULL;
3803 __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
3804 __pyx_t_18.memview = NULL;
3805 __pyx_t_18.data = NULL;
3806 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
3807 __pyx_t_19.memview = NULL;
3808 __pyx_t_19.data = NULL;
3809 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
3810 __pyx_t_20.memview = NULL;
3811 __pyx_t_20.data = NULL;
3812 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
3813 __pyx_t_21.memview = NULL;
3814 __pyx_t_21.data = NULL;
3815 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
3816 __pyx_t_22.memview = NULL;
3817 __pyx_t_22.data = NULL;
3818 __pyx_v_all_converged = __pyx_t_23;
3837 __Pyx_TraceLine(98,0,__PYX_ERR(0, 98, __pyx_L1_error))
3838 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float64, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 98, __pyx_L1_error)
3848 __Pyx_TraceLine(103,0,__PYX_ERR(0, 103, __pyx_L1_error))
3849 __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_15 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 103, __pyx_L1_error)
3858 __Pyx_TraceLine(105,0,__PYX_ERR(0, 105, __pyx_L1_error))
3859 __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_exponent);
if (unlikely((__pyx_t_24 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L1_error)
3868 __Pyx_TraceLine(106,0,__PYX_ERR(0, 106, __pyx_L1_error))
3869 __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_symmetric);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __pyx_L1_error)
3870 __Pyx_GOTREF(__pyx_t_4);
3871 __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_4);
if (unlikely((__pyx_t_23 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L1_error)
3872 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3881 __Pyx_TraceLine(107,0,__PYX_ERR(0, 107, __pyx_L1_error))
3882 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L1_error)
3891 __Pyx_TraceLine(108,0,__PYX_ERR(0, 108, __pyx_L1_error))
3892 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L1_error)
3901 __Pyx_TraceLine(109,0,__PYX_ERR(0, 109, __pyx_L1_error))
3902 __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_25 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L1_error)
3911 __Pyx_TraceLine(110,0,__PYX_ERR(0, 110, __pyx_L1_error))
3912 __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_9 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L1_error)
3921 __Pyx_TraceLine(111,0,__PYX_ERR(0, 111, __pyx_L1_error))
3922 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L1_error)
3931 __Pyx_TraceLine(112,0,__PYX_ERR(0, 112, __pyx_L1_error))
3932 __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_error_atol);
if (unlikely((__pyx_t_26 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L1_error)
3941 __Pyx_TraceLine(113,0,__PYX_ERR(0, 113, __pyx_L1_error))
3942 __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_v_error_rtol);
if (unlikely((__pyx_t_27 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 113, __pyx_L1_error)
3951 __Pyx_TraceLine(114,0,__PYX_ERR(0, 114, __pyx_L1_error))
3952 __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_v_confidence_level);
if (unlikely((__pyx_t_28 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 114, __pyx_L1_error)
3961 __Pyx_TraceLine(115,0,__PYX_ERR(0, 115, __pyx_L1_error))
3962 __pyx_t_29 = __pyx_PyFloat_AsDouble(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_29 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 115, __pyx_L1_error)
3971 __Pyx_TraceLine(116,0,__PYX_ERR(0, 116, __pyx_L1_error))
3972 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L1_error)
3981 __Pyx_TraceLine(117,0,__PYX_ERR(0, 117, __pyx_L1_error))
3982 __pyx_t_30 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_30.memview)) __PYX_ERR(0, 117, __pyx_L1_error)
3991 __Pyx_TraceLine(118,0,__PYX_ERR(0, 118, __pyx_L1_error))
3992 __pyx_t_31 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_31.memview)) __PYX_ERR(0, 118, __pyx_L1_error)
4001 __Pyx_TraceLine(119,0,__PYX_ERR(0, 119, __pyx_L1_error))
4002 __pyx_t_32 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_32.memview)) __PYX_ERR(0, 119, __pyx_L1_error)
4011 __Pyx_TraceLine(120,0,__PYX_ERR(0, 120, __pyx_L1_error))
4012 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 120, __pyx_L1_error)
4021 __Pyx_TraceLine(121,0,__PYX_ERR(0, 121, __pyx_L1_error))
4022 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 121, __pyx_L1_error)
4031 __Pyx_TraceLine(122,0,__PYX_ERR(0, 122, __pyx_L1_error))
4032 __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 122, __pyx_L1_error)
4041 __Pyx_TraceLine(123,0,__PYX_ERR(0, 123, __pyx_L1_error))
4042 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 123, __pyx_L1_error)
4051 __Pyx_TraceLine(100,0,__PYX_ERR(0, 100, __pyx_L1_error))
4052 __pyx_t_5 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_15, __pyx_v_py_matrix_function, __pyx_t_24, __pyx_t_23, __pyx_t_6, __pyx_t_10, __pyx_t_25, __pyx_t_9, __pyx_t_7, __pyx_t_26, __pyx_t_27, __pyx_t_28, __pyx_t_29, __pyx_t_2, __pyx_t_30, __pyx_t_31, __pyx_t_32, __pyx_t_21, __pyx_t_20, __pyx_t_19, __pyx_t_22, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_5 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L1_error)
4053 __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
4054 __pyx_t_30.memview = NULL;
4055 __pyx_t_30.data = NULL;
4056 __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
4057 __pyx_t_31.memview = NULL;
4058 __pyx_t_31.data = NULL;
4059 __PYX_XDEC_MEMVIEW(&__pyx_t_32, 1);
4060 __pyx_t_32.memview = NULL;
4061 __pyx_t_32.data = NULL;
4062 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4063 __pyx_t_21.memview = NULL;
4064 __pyx_t_21.data = NULL;
4065 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4066 __pyx_t_20.memview = NULL;
4067 __pyx_t_20.data = NULL;
4068 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
4069 __pyx_t_19.memview = NULL;
4070 __pyx_t_19.data = NULL;
4071 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4072 __pyx_t_22.memview = NULL;
4073 __pyx_t_22.data = NULL;
4074 __pyx_v_all_converged = __pyx_t_5;
4093 __Pyx_TraceLine(126,0,__PYX_ERR(0, 126, __pyx_L1_error))
4094 __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_data_type_name, __pyx_n_b_float128, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 126, __pyx_L1_error)
4095 if (likely(__pyx_t_1)) {
4104 __Pyx_TraceLine(131,0,__PYX_ERR(0, 131, __pyx_L1_error))
4105 __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_num_inquiries);
if (unlikely((__pyx_t_2 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
4114 __Pyx_TraceLine(133,0,__PYX_ERR(0, 133, __pyx_L1_error))
4115 __pyx_t_33 = __pyx_PyFloat_AsDouble(__pyx_v_exponent);
if (unlikely((__pyx_t_33 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L1_error)
4124 __Pyx_TraceLine(134,0,__PYX_ERR(0, 134, __pyx_L1_error))
4125 __pyx_t_4 = __Pyx_PyNumber_Int(__pyx_v_symmetric);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error)
4126 __Pyx_GOTREF(__pyx_t_4);
4127 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_4);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
4128 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4137 __Pyx_TraceLine(135,0,__PYX_ERR(0, 135, __pyx_L1_error))
4138 __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_reorthogonalize);
if (unlikely((__pyx_t_6 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L1_error)
4147 __Pyx_TraceLine(136,0,__PYX_ERR(0, 136, __pyx_L1_error))
4148 __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_lanczos_degree);
if (unlikely((__pyx_t_7 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
4157 __Pyx_TraceLine(137,0,__PYX_ERR(0, 137, __pyx_L1_error))
4158 __pyx_t_34 = __pyx_PyFloat_AsDouble(__pyx_v_lanczos_tol);
if (unlikely((__pyx_t_34 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L1_error)
4167 __Pyx_TraceLine(138,0,__PYX_ERR(0, 138, __pyx_L1_error))
4168 __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_v_min_num_samples);
if (unlikely((__pyx_t_9 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
4177 __Pyx_TraceLine(139,0,__PYX_ERR(0, 139, __pyx_L1_error))
4178 __pyx_t_10 = __Pyx_PyInt_As_int(__pyx_v_max_num_samples);
if (unlikely((__pyx_t_10 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L1_error)
4187 __Pyx_TraceLine(140,0,__PYX_ERR(0, 140, __pyx_L1_error))
4188 __pyx_t_35 = __pyx_PyFloat_AsDouble(__pyx_v_error_atol);
if (unlikely((__pyx_t_35 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
4197 __Pyx_TraceLine(141,0,__PYX_ERR(0, 141, __pyx_L1_error))
4198 __pyx_t_36 = __pyx_PyFloat_AsDouble(__pyx_v_error_rtol);
if (unlikely((__pyx_t_36 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L1_error)
4207 __Pyx_TraceLine(142,0,__PYX_ERR(0, 142, __pyx_L1_error))
4208 __pyx_t_37 = __pyx_PyFloat_AsDouble(__pyx_v_confidence_level);
if (unlikely((__pyx_t_37 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
4217 __Pyx_TraceLine(143,0,__PYX_ERR(0, 143, __pyx_L1_error))
4218 __pyx_t_38 = __pyx_PyFloat_AsDouble(__pyx_v_outlier_significance_level);
if (unlikely((__pyx_t_38 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L1_error)
4227 __Pyx_TraceLine(144,0,__PYX_ERR(0, 144, __pyx_L1_error))
4228 __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_num_threads);
if (unlikely((__pyx_t_15 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error)
4237 __Pyx_TraceLine(145,0,__PYX_ERR(0, 145, __pyx_L1_error))
4238 __pyx_t_39 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_trace, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_39.memview)) __PYX_ERR(0, 145, __pyx_L1_error)
4247 __Pyx_TraceLine(146,0,__PYX_ERR(0, 146, __pyx_L1_error))
4248 __pyx_t_40 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_error, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_40.memview)) __PYX_ERR(0, 146, __pyx_L1_error)
4257 __Pyx_TraceLine(147,0,__PYX_ERR(0, 147, __pyx_L1_error))
4258 __pyx_t_41 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(__pyx_v_samples, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_41.memview)) __PYX_ERR(0, 147, __pyx_L1_error)
4267 __Pyx_TraceLine(148,0,__PYX_ERR(0, 148, __pyx_L1_error))
4268 __pyx_t_19 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_processed_samples_indices, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_19.memview)) __PYX_ERR(0, 148, __pyx_L1_error)
4277 __Pyx_TraceLine(149,0,__PYX_ERR(0, 149, __pyx_L1_error))
4278 __pyx_t_20 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_samples_used, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_20.memview)) __PYX_ERR(0, 149, __pyx_L1_error)
4287 __Pyx_TraceLine(150,0,__PYX_ERR(0, 150, __pyx_L1_error))
4288 __pyx_t_21 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_num_outliers, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_21.memview)) __PYX_ERR(0, 150, __pyx_L1_error)
4297 __Pyx_TraceLine(151,0,__PYX_ERR(0, 151, __pyx_L1_error))
4298 __pyx_t_22 = __Pyx_PyObject_to_MemoryviewSlice_ds_int(__pyx_v_converged, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_22.memview)) __PYX_ERR(0, 151, __pyx_L1_error)
4307 __Pyx_TraceLine(128,0,__PYX_ERR(0, 128, __pyx_L1_error))
4308 __pyx_t_23 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(__pyx_v_Aop, __pyx_v_parameters, __pyx_t_2, __pyx_v_py_matrix_function, __pyx_t_33, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_34, __pyx_t_9, __pyx_t_10, __pyx_t_35, __pyx_t_36, __pyx_t_37, __pyx_t_38, __pyx_t_15, __pyx_t_39, __pyx_t_40, __pyx_t_41, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_v_alg_wall_time);
if (unlikely(__pyx_t_23 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 128, __pyx_L1_error)
4309 __PYX_XDEC_MEMVIEW(&__pyx_t_39, 1);
4310 __pyx_t_39.memview = NULL;
4311 __pyx_t_39.data = NULL;
4312 __PYX_XDEC_MEMVIEW(&__pyx_t_40, 1);
4313 __pyx_t_40.memview = NULL;
4314 __pyx_t_40.data = NULL;
4315 __PYX_XDEC_MEMVIEW(&__pyx_t_41, 1);
4316 __pyx_t_41.memview = NULL;
4317 __pyx_t_41.data = NULL;
4318 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
4319 __pyx_t_19.memview = NULL;
4320 __pyx_t_19.data = NULL;
4321 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4322 __pyx_t_20.memview = NULL;
4323 __pyx_t_20.data = NULL;
4324 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4325 __pyx_t_21.memview = NULL;
4326 __pyx_t_21.data = NULL;
4327 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4328 __pyx_t_22.memview = NULL;
4329 __pyx_t_22.data = NULL;
4330 __pyx_v_all_converged = __pyx_t_23;
4349 __Pyx_TraceLine(155,0,__PYX_ERR(0, 155, __pyx_L1_error))
4351 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 155, __pyx_L1_error)
4352 __Pyx_GOTREF(__pyx_t_4);
4353 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
4354 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4355 __PYX_ERR(0, 155, __pyx_L1_error)
4366 __Pyx_TraceLine(159,0,__PYX_ERR(0, 159, __pyx_L1_error))
4367 __pyx_t_4 = PyFloat_FromDouble(__pyx_v_alg_wall_time);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error)
4368 __Pyx_GOTREF(__pyx_t_4);
4369 if (unlikely(__Pyx_SetItemInt(__pyx_v_alg_wall_times, 0, __pyx_t_4,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0) < 0)) __PYX_ERR(0, 159, __pyx_L1_error)
4370 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4379 __Pyx_TraceLine(161,0,__PYX_ERR(0, 161, __pyx_L1_error))
4380 __pyx_r = __pyx_v_all_converged;
4393 __Pyx_XDECREF(__pyx_t_4);
4394 __PYX_XDEC_MEMVIEW(&__pyx_t_16, 1);
4395 __PYX_XDEC_MEMVIEW(&__pyx_t_17, 1);
4396 __PYX_XDEC_MEMVIEW(&__pyx_t_18, 1);
4397 __PYX_XDEC_MEMVIEW(&__pyx_t_19, 1);
4398 __PYX_XDEC_MEMVIEW(&__pyx_t_20, 1);
4399 __PYX_XDEC_MEMVIEW(&__pyx_t_21, 1);
4400 __PYX_XDEC_MEMVIEW(&__pyx_t_22, 1);
4401 __PYX_XDEC_MEMVIEW(&__pyx_t_30, 1);
4402 __PYX_XDEC_MEMVIEW(&__pyx_t_31, 1);
4403 __PYX_XDEC_MEMVIEW(&__pyx_t_32, 1);
4404 __PYX_XDEC_MEMVIEW(&__pyx_t_39, 1);
4405 __PYX_XDEC_MEMVIEW(&__pyx_t_40, 1);
4406 __PYX_XDEC_MEMVIEW(&__pyx_t_41, 1);
4407 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4410 __Pyx_TraceReturn(Py_None, 0);
4411 __Pyx_RefNannyFinishContext();
4416 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
4417 static char __pyx_doc_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator[] =
"pyc_trace_estimator(pycLinearOperator Aop, parameters, num_inquiries, pyFunction py_matrix_function, exponent, symmetric, reorthogonalize, lanczos_degree, lanczos_tol, min_num_samples, max_num_samples, error_atol, error_rtol, confidence_level, outlier_significance_level, num_threads, data_type_name, trace, error, samples, processed_samples_indices, num_samples_used, num_outliers, converged, alg_wall_times) -> FlagType\n\n ";
4418 static PyMethodDef __pyx_mdef_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator = {
"pyc_trace_estimator", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator};
4419 static PyObject *__pyx_pw_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4420 struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop = 0;
4421 PyObject *__pyx_v_parameters = 0;
4422 PyObject *__pyx_v_num_inquiries = 0;
4423 struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function = 0;
4424 PyObject *__pyx_v_exponent = 0;
4425 PyObject *__pyx_v_symmetric = 0;
4426 PyObject *__pyx_v_reorthogonalize = 0;
4427 PyObject *__pyx_v_lanczos_degree = 0;
4428 PyObject *__pyx_v_lanczos_tol = 0;
4429 PyObject *__pyx_v_min_num_samples = 0;
4430 PyObject *__pyx_v_max_num_samples = 0;
4431 PyObject *__pyx_v_error_atol = 0;
4432 PyObject *__pyx_v_error_rtol = 0;
4433 PyObject *__pyx_v_confidence_level = 0;
4434 PyObject *__pyx_v_outlier_significance_level = 0;
4435 PyObject *__pyx_v_num_threads = 0;
4436 PyObject *__pyx_v_data_type_name = 0;
4437 PyObject *__pyx_v_trace = 0;
4438 PyObject *__pyx_v_error = 0;
4439 PyObject *__pyx_v_samples = 0;
4440 PyObject *__pyx_v_processed_samples_indices = 0;
4441 PyObject *__pyx_v_num_samples_used = 0;
4442 PyObject *__pyx_v_num_outliers = 0;
4443 PyObject *__pyx_v_converged = 0;
4444 PyObject *__pyx_v_alg_wall_times = 0;
4445 int __pyx_lineno = 0;
4446 const char *__pyx_filename = NULL;
4447 int __pyx_clineno = 0;
4448 PyObject *__pyx_r = 0;
4449 __Pyx_RefNannyDeclarations
4450 __Pyx_RefNannySetupContext(
"pyc_trace_estimator (wrapper)", 0);
4452 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_Aop,&__pyx_n_s_parameters,&__pyx_n_s_num_inquiries,&__pyx_n_s_py_matrix_function,&__pyx_n_s_exponent,&__pyx_n_s_symmetric,&__pyx_n_s_reorthogonalize,&__pyx_n_s_lanczos_degree,&__pyx_n_s_lanczos_tol,&__pyx_n_s_min_num_samples,&__pyx_n_s_max_num_samples,&__pyx_n_s_error_atol,&__pyx_n_s_error_rtol,&__pyx_n_s_confidence_level,&__pyx_n_s_outlier_significance_level,&__pyx_n_s_num_threads,&__pyx_n_s_data_type_name,&__pyx_n_s_trace,&__pyx_n_s_error,&__pyx_n_s_samples,&__pyx_n_s_processed_samples_indices,&__pyx_n_s_num_samples_used,&__pyx_n_s_num_outliers,&__pyx_n_s_converged,&__pyx_n_s_alg_wall_times,0};
4453 PyObject* values[25] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
4454 if (unlikely(__pyx_kwds)) {
4456 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4458 case 25: values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
4460 case 24: values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
4462 case 23: values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
4464 case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
4466 case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
4468 case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
4470 case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
4472 case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
4474 case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
4476 case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
4478 case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
4480 case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
4482 case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
4484 case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
4486 case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
4488 case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
4490 case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4492 case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4494 case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4496 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4498 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4500 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4502 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4504 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4506 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4509 default:
goto __pyx_L5_argtuple_error;
4511 kw_args = PyDict_Size(__pyx_kwds);
4514 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Aop)) != 0)) kw_args--;
4515 else goto __pyx_L5_argtuple_error;
4518 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parameters)) != 0)) kw_args--;
4520 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 1); __PYX_ERR(0, 38, __pyx_L3_error)
4524 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_inquiries)) != 0)) kw_args--;
4526 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 2); __PYX_ERR(0, 38, __pyx_L3_error)
4530 if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_py_matrix_function)) != 0)) kw_args--;
4532 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 3); __PYX_ERR(0, 38, __pyx_L3_error)
4536 if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_exponent)) != 0)) kw_args--;
4538 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 4); __PYX_ERR(0, 38, __pyx_L3_error)
4542 if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_symmetric)) != 0)) kw_args--;
4544 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 5); __PYX_ERR(0, 38, __pyx_L3_error)
4548 if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_reorthogonalize)) != 0)) kw_args--;
4550 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 6); __PYX_ERR(0, 38, __pyx_L3_error)
4554 if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lanczos_degree)) != 0)) kw_args--;
4556 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 7); __PYX_ERR(0, 38, __pyx_L3_error)
4560 if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lanczos_tol)) != 0)) kw_args--;
4562 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 8); __PYX_ERR(0, 38, __pyx_L3_error)
4566 if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_min_num_samples)) != 0)) kw_args--;
4568 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 9); __PYX_ERR(0, 38, __pyx_L3_error)
4572 if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_num_samples)) != 0)) kw_args--;
4574 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 10); __PYX_ERR(0, 38, __pyx_L3_error)
4578 if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_atol)) != 0)) kw_args--;
4580 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 11); __PYX_ERR(0, 38, __pyx_L3_error)
4584 if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error_rtol)) != 0)) kw_args--;
4586 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 12); __PYX_ERR(0, 38, __pyx_L3_error)
4590 if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_confidence_level)) != 0)) kw_args--;
4592 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 13); __PYX_ERR(0, 38, __pyx_L3_error)
4596 if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_outlier_significance_level)) != 0)) kw_args--;
4598 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 14); __PYX_ERR(0, 38, __pyx_L3_error)
4602 if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--;
4604 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 15); __PYX_ERR(0, 38, __pyx_L3_error)
4608 if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_type_name)) != 0)) kw_args--;
4610 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 16); __PYX_ERR(0, 38, __pyx_L3_error)
4614 if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_trace)) != 0)) kw_args--;
4616 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 17); __PYX_ERR(0, 38, __pyx_L3_error)
4620 if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_error)) != 0)) kw_args--;
4622 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 18); __PYX_ERR(0, 38, __pyx_L3_error)
4626 if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--;
4628 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 19); __PYX_ERR(0, 38, __pyx_L3_error)
4632 if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_processed_samples_indices)) != 0)) kw_args--;
4634 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 20); __PYX_ERR(0, 38, __pyx_L3_error)
4638 if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_samples_used)) != 0)) kw_args--;
4640 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 21); __PYX_ERR(0, 38, __pyx_L3_error)
4644 if (likely((values[22] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_outliers)) != 0)) kw_args--;
4646 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 22); __PYX_ERR(0, 38, __pyx_L3_error)
4650 if (likely((values[23] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_converged)) != 0)) kw_args--;
4652 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 23); __PYX_ERR(0, 38, __pyx_L3_error)
4656 if (likely((values[24] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_alg_wall_times)) != 0)) kw_args--;
4658 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, 24); __PYX_ERR(0, 38, __pyx_L3_error)
4661 if (unlikely(kw_args > 0)) {
4662 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"pyc_trace_estimator") < 0)) __PYX_ERR(0, 38, __pyx_L3_error)
4664 }
else if (PyTuple_GET_SIZE(__pyx_args) != 25) {
4665 goto __pyx_L5_argtuple_error;
4667 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4668 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4669 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4670 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
4671 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
4672 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
4673 values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
4674 values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
4675 values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
4676 values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
4677 values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
4678 values[11] = PyTuple_GET_ITEM(__pyx_args, 11);
4679 values[12] = PyTuple_GET_ITEM(__pyx_args, 12);
4680 values[13] = PyTuple_GET_ITEM(__pyx_args, 13);
4681 values[14] = PyTuple_GET_ITEM(__pyx_args, 14);
4682 values[15] = PyTuple_GET_ITEM(__pyx_args, 15);
4683 values[16] = PyTuple_GET_ITEM(__pyx_args, 16);
4684 values[17] = PyTuple_GET_ITEM(__pyx_args, 17);
4685 values[18] = PyTuple_GET_ITEM(__pyx_args, 18);
4686 values[19] = PyTuple_GET_ITEM(__pyx_args, 19);
4687 values[20] = PyTuple_GET_ITEM(__pyx_args, 20);
4688 values[21] = PyTuple_GET_ITEM(__pyx_args, 21);
4689 values[22] = PyTuple_GET_ITEM(__pyx_args, 22);
4690 values[23] = PyTuple_GET_ITEM(__pyx_args, 23);
4691 values[24] = PyTuple_GET_ITEM(__pyx_args, 24);
4693 __pyx_v_Aop = ((
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)values[0]);
4694 __pyx_v_parameters = values[1];
4695 __pyx_v_num_inquiries = values[2];
4696 __pyx_v_py_matrix_function = ((
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *)values[3]);
4697 __pyx_v_exponent = values[4];
4698 __pyx_v_symmetric = values[5];
4699 __pyx_v_reorthogonalize = values[6];
4700 __pyx_v_lanczos_degree = values[7];
4701 __pyx_v_lanczos_tol = values[8];
4702 __pyx_v_min_num_samples = values[9];
4703 __pyx_v_max_num_samples = values[10];
4704 __pyx_v_error_atol = values[11];
4705 __pyx_v_error_rtol = values[12];
4706 __pyx_v_confidence_level = values[13];
4707 __pyx_v_outlier_significance_level = values[14];
4708 __pyx_v_num_threads = values[15];
4709 __pyx_v_data_type_name = values[16];
4710 __pyx_v_trace = values[17];
4711 __pyx_v_error = values[18];
4712 __pyx_v_samples = values[19];
4713 __pyx_v_processed_samples_indices = values[20];
4714 __pyx_v_num_samples_used = values[21];
4715 __pyx_v_num_outliers = values[22];
4716 __pyx_v_converged = values[23];
4717 __pyx_v_alg_wall_times = values[24];
4719 goto __pyx_L4_argument_unpacking_done;
4720 __pyx_L5_argtuple_error:;
4721 __Pyx_RaiseArgtupleInvalid(
"pyc_trace_estimator", 1, 25, 25, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error)
4723 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4724 __Pyx_RefNannyFinishContext();
4726 __pyx_L4_argument_unpacking_done:;
4727 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Aop), __pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator, 1,
"Aop", 0))) __PYX_ERR(0, 39, __pyx_L1_error)
4728 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_py_matrix_function), __pyx_ptype_5imate_9functions_12py_functions_pyFunction, 1,
"py_matrix_function", 0))) __PYX_ERR(0, 42, __pyx_L1_error)
4729 __pyx_r = __pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(__pyx_self, __pyx_v_Aop, __pyx_v_parameters, __pyx_v_num_inquiries, __pyx_v_py_matrix_function, __pyx_v_exponent, __pyx_v_symmetric, __pyx_v_reorthogonalize, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_data_type_name, __pyx_v_trace, __pyx_v_error, __pyx_v_samples, __pyx_v_processed_samples_indices, __pyx_v_num_samples_used, __pyx_v_num_outliers, __pyx_v_converged, __pyx_v_alg_wall_times);
4736 __Pyx_RefNannyFinishContext();
4740 static PyObject *__pyx_pf_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(CYTHON_UNUSED PyObject *__pyx_self,
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, PyObject *__pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function, PyObject *__pyx_v_exponent, PyObject *__pyx_v_symmetric, PyObject *__pyx_v_reorthogonalize, PyObject *__pyx_v_lanczos_degree, PyObject *__pyx_v_lanczos_tol, PyObject *__pyx_v_min_num_samples, PyObject *__pyx_v_max_num_samples, PyObject *__pyx_v_error_atol, PyObject *__pyx_v_error_rtol, PyObject *__pyx_v_confidence_level, PyObject *__pyx_v_outlier_significance_level, PyObject *__pyx_v_num_threads, PyObject *__pyx_v_data_type_name, PyObject *__pyx_v_trace, PyObject *__pyx_v_error, PyObject *__pyx_v_samples, PyObject *__pyx_v_processed_samples_indices, PyObject *__pyx_v_num_samples_used, PyObject *__pyx_v_num_outliers, PyObject *__pyx_v_converged, PyObject *__pyx_v_alg_wall_times) {
4741 PyObject *__pyx_r = NULL;
4742 __Pyx_TraceDeclarations
4743 __Pyx_RefNannyDeclarations
4744 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_t_1;
4745 PyObject *__pyx_t_2 = NULL;
4746 int __pyx_lineno = 0;
4747 const char *__pyx_filename = NULL;
4748 int __pyx_clineno = 0;
4749 __Pyx_TraceFrameInit(__pyx_codeobj_)
4750 __Pyx_RefNannySetupContext(
"pyc_trace_estimator", 0);
4751 __Pyx_TraceCall(
"pyc_trace_estimator (wrapper)", __pyx_f[0], 38, 0, __PYX_ERR(0, 38, __pyx_L1_error));
4752 __Pyx_XDECREF(__pyx_r);
4753 __pyx_t_1 = __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator(__pyx_v_Aop, __pyx_v_parameters, __pyx_v_num_inquiries, __pyx_v_py_matrix_function, __pyx_v_exponent, __pyx_v_symmetric, __pyx_v_reorthogonalize, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_data_type_name, __pyx_v_trace, __pyx_v_error, __pyx_v_samples, __pyx_v_processed_samples_indices, __pyx_v_num_samples_used, __pyx_v_num_outliers, __pyx_v_converged, __pyx_v_alg_wall_times, 0);
if (unlikely(__pyx_t_1 == ((__pyx_t_5imate_12_definitions_5types_FlagType)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error)
4754 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_t_1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error)
4755 __Pyx_GOTREF(__pyx_t_2);
4756 __pyx_r = __pyx_t_2;
4762 __Pyx_XDECREF(__pyx_t_2);
4763 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator.pyc_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
4766 __Pyx_XGIVEREF(__pyx_r);
4767 __Pyx_TraceReturn(__pyx_r, 0);
4768 __Pyx_RefNannyFinishContext();
4780 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_float(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function,
float const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_symmetric, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
float const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
float const __pyx_v_error_atol,
float const __pyx_v_error_rtol,
float const __pyx_v_confidence_level,
float const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
4781 float *__pyx_v_c_parameters;
4782 float __pyx_v_scalar_parameters;
4783 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
4784 float *__pyx_v_c_trace;
4785 float *__pyx_v_c_error;
4786 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
4787 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
4788 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
4789 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
4790 float **__pyx_v_c_samples;
4791 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
4792 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
4795 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
4796 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
4797 __Pyx_TraceDeclarations
4798 __Pyx_RefNannyDeclarations
4801 PyObject *__pyx_t_3 = NULL;
4802 PyObject *__pyx_t_4 = NULL;
4803 PyObject *__pyx_t_5 = NULL;
4805 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
4806 Py_ssize_t __pyx_t_8;
4807 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
4808 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
4809 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
4810 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
4811 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
4812 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
4816 Py_ssize_t __pyx_t_18;
4817 Py_ssize_t __pyx_t_19;
4818 int __pyx_lineno = 0;
4819 const char *__pyx_filename = NULL;
4820 int __pyx_clineno = 0;
4821 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_float", 0);
4822 __Pyx_TraceCall(
"_pyc_trace_estimator_float", __pyx_f[0], 168, 0, __PYX_ERR(0, 168, __pyx_L1_error));
4831 __Pyx_TraceLine(201,0,__PYX_ERR(0, 201, __pyx_L1_error))
4832 __pyx_t_1 = (__pyx_v_parameters == Py_None);
4833 __pyx_t_2 = (__pyx_t_1 != 0);
4843 __Pyx_TraceLine(202,0,__PYX_ERR(0, 202, __pyx_L1_error))
4844 __pyx_v_c_parameters = NULL;
4863 __Pyx_TraceLine(204,0,__PYX_ERR(0, 204, __pyx_L1_error))
4864 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
4865 __Pyx_GOTREF(__pyx_t_4);
4866 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error)
4867 __Pyx_GOTREF(__pyx_t_5);
4868 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4870 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4871 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
4872 if (likely(__pyx_t_4)) {
4873 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
4874 __Pyx_INCREF(__pyx_t_4);
4875 __Pyx_INCREF(
function);
4876 __Pyx_DECREF_SET(__pyx_t_5,
function);
4879 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
4880 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
4881 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error)
4882 __Pyx_GOTREF(__pyx_t_3);
4883 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4884 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 204, __pyx_L1_error)
4885 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4895 __Pyx_TraceLine(205,0,__PYX_ERR(0, 205, __pyx_L1_error))
4896 __pyx_t_6 = __pyx_PyFloat_AsFloat(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
float)-1) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error)
4897 __pyx_v_scalar_parameters = __pyx_t_6;
4906 __Pyx_TraceLine(206,0,__PYX_ERR(0, 206, __pyx_L1_error))
4907 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
4926 __Pyx_TraceLine(209,0,__PYX_ERR(0, 209, __pyx_L1_error))
4928 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_float(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 209, __pyx_L1_error)
4929 __pyx_v_array_parameters = __pyx_t_7;
4930 __pyx_t_7.memview = NULL;
4931 __pyx_t_7.data = NULL;
4940 __Pyx_TraceLine(210,0,__PYX_ERR(0, 210, __pyx_L1_error))
4942 __pyx_v_c_parameters = (&(*((
float *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
4953 __Pyx_TraceLine(213,0,__PYX_ERR(0, 213, __pyx_L1_error))
4955 __pyx_v_c_trace = (&(*((
float *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
4964 __Pyx_TraceLine(214,0,__PYX_ERR(0, 214, __pyx_L1_error))
4966 __pyx_v_c_error = (&(*((
float *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
4975 __Pyx_TraceLine(215,0,__PYX_ERR(0, 215, __pyx_L1_error))
4977 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
4986 __Pyx_TraceLine(216,0,__PYX_ERR(0, 216, __pyx_L1_error))
4988 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
4997 __Pyx_TraceLine(217,0,__PYX_ERR(0, 217, __pyx_L1_error))
4999 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
5008 __Pyx_TraceLine(218,0,__PYX_ERR(0, 218, __pyx_L1_error))
5010 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
5019 __Pyx_TraceLine(222,0,__PYX_ERR(0, 222, __pyx_L1_error))
5020 __pyx_v_c_samples = ((
float **)malloc(((
sizeof(
float *)) * __pyx_v_max_num_samples)));
5029 __Pyx_TraceLine(224,0,__PYX_ERR(0, 224, __pyx_L1_error))
5030 __pyx_t_9 = __pyx_v_max_num_samples;
5031 __pyx_t_10 = __pyx_t_9;
5032 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5033 __pyx_v_i = __pyx_t_11;
5042 __Pyx_TraceLine(225,0,__PYX_ERR(0, 225, __pyx_L1_error))
5043 (__pyx_v_c_samples[__pyx_v_i]) = ((
float *)malloc(((
sizeof(
float)) * __pyx_v_num_inquiries)));
5052 __Pyx_TraceLine(227,0,__PYX_ERR(0, 227, __pyx_L1_error))
5053 __pyx_t_12 = __pyx_v_num_inquiries;
5054 __pyx_t_13 = __pyx_t_12;
5055 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5056 __pyx_v_j = __pyx_t_14;
5065 __Pyx_TraceLine(228,0,__PYX_ERR(0, 228, __pyx_L1_error))
5066 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5077 __Pyx_TraceLine(231,0,__PYX_ERR(0, 231, __pyx_L1_error))
5078 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_float(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error)
5079 __pyx_v_Aop_float = __pyx_t_15;
5088 __Pyx_TraceLine(233,0,__PYX_ERR(0, 233, __pyx_L1_error))
5089 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5098 __Pyx_TraceLine(237,0,__PYX_ERR(0, 237, __pyx_L1_error))
5099 __pyx_v_all_converged =
cTraceEstimator<float> ::c_trace_estimator(__pyx_v_Aop_float, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_exponent, ((__pyx_t_5imate_12_definitions_5types_FlagType
const )__pyx_v_symmetric), __pyx_v_reorthogonalize, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5108 __Pyx_TraceLine(265,0,__PYX_ERR(0, 265, __pyx_L1_error))
5109 __pyx_t_9 = __pyx_v_num_inquiries;
5110 __pyx_t_10 = __pyx_t_9;
5111 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5112 __pyx_v_j = __pyx_t_11;
5121 __Pyx_TraceLine(266,0,__PYX_ERR(0, 266, __pyx_L1_error))
5122 __pyx_t_8 = __pyx_v_j;
5123 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
5124 __pyx_t_17 = __pyx_t_16;
5125 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
5126 __pyx_v_i = __pyx_t_12;
5135 __Pyx_TraceLine(267,0,__PYX_ERR(0, 267, __pyx_L1_error))
5136 __pyx_t_8 = __pyx_v_i;
5137 __pyx_t_18 = __pyx_v_i;
5138 __pyx_t_19 = __pyx_v_j;
5139 *((
float *) ( ((
char *) (((
float *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
5150 __Pyx_TraceLine(272,0,__PYX_ERR(0, 272, __pyx_L1_error))
5151 __pyx_t_9 = __pyx_v_max_num_samples;
5152 __pyx_t_10 = __pyx_t_9;
5153 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5154 __pyx_v_i = __pyx_t_11;
5163 __Pyx_TraceLine(273,0,__PYX_ERR(0, 273, __pyx_L1_error))
5164 free((__pyx_v_c_samples[__pyx_v_i]));
5174 __Pyx_TraceLine(274,0,__PYX_ERR(0, 274, __pyx_L1_error))
5175 free(__pyx_v_c_samples);
5184 __Pyx_TraceLine(276,0,__PYX_ERR(0, 276, __pyx_L1_error))
5185 __pyx_r = __pyx_v_all_converged;
5198 __Pyx_XDECREF(__pyx_t_3);
5199 __Pyx_XDECREF(__pyx_t_4);
5200 __Pyx_XDECREF(__pyx_t_5);
5201 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
5202 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_float", __pyx_clineno, __pyx_lineno, __pyx_filename);
5205 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
5206 __Pyx_TraceReturn(Py_None, 0);
5207 __Pyx_RefNannyFinishContext();
5219 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function,
double const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_symmetric, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
double const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
double const __pyx_v_error_atol,
double const __pyx_v_error_rtol,
double const __pyx_v_confidence_level,
double const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
5220 double *__pyx_v_c_parameters;
5221 double __pyx_v_scalar_parameters;
5222 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
5223 double *__pyx_v_c_trace;
5224 double *__pyx_v_c_error;
5225 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
5226 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
5227 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
5228 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
5229 double **__pyx_v_c_samples;
5230 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
5231 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
5234 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
5235 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
5236 __Pyx_TraceDeclarations
5237 __Pyx_RefNannyDeclarations
5240 PyObject *__pyx_t_3 = NULL;
5241 PyObject *__pyx_t_4 = NULL;
5242 PyObject *__pyx_t_5 = NULL;
5244 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
5245 Py_ssize_t __pyx_t_8;
5246 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
5247 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5248 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5249 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5250 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5251 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
5255 Py_ssize_t __pyx_t_18;
5256 Py_ssize_t __pyx_t_19;
5257 int __pyx_lineno = 0;
5258 const char *__pyx_filename = NULL;
5259 int __pyx_clineno = 0;
5260 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_double", 0);
5261 __Pyx_TraceCall(
"_pyc_trace_estimator_double", __pyx_f[0], 283, 0, __PYX_ERR(0, 283, __pyx_L1_error));
5270 __Pyx_TraceLine(316,0,__PYX_ERR(0, 316, __pyx_L1_error))
5271 __pyx_t_1 = (__pyx_v_parameters == Py_None);
5272 __pyx_t_2 = (__pyx_t_1 != 0);
5282 __Pyx_TraceLine(317,0,__PYX_ERR(0, 317, __pyx_L1_error))
5283 __pyx_v_c_parameters = NULL;
5302 __Pyx_TraceLine(319,0,__PYX_ERR(0, 319, __pyx_L1_error))
5303 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 319, __pyx_L1_error)
5304 __Pyx_GOTREF(__pyx_t_4);
5305 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 319, __pyx_L1_error)
5306 __Pyx_GOTREF(__pyx_t_5);
5307 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5309 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5310 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5311 if (likely(__pyx_t_4)) {
5312 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
5313 __Pyx_INCREF(__pyx_t_4);
5314 __Pyx_INCREF(
function);
5315 __Pyx_DECREF_SET(__pyx_t_5,
function);
5318 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
5319 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5320 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 319, __pyx_L1_error)
5321 __Pyx_GOTREF(__pyx_t_3);
5322 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5323 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 319, __pyx_L1_error)
5324 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5334 __Pyx_TraceLine(320,0,__PYX_ERR(0, 320, __pyx_L1_error))
5335 __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
double)-1) && PyErr_Occurred())) __PYX_ERR(0, 320, __pyx_L1_error)
5336 __pyx_v_scalar_parameters = __pyx_t_6;
5345 __Pyx_TraceLine(321,0,__PYX_ERR(0, 321, __pyx_L1_error))
5346 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
5365 __Pyx_TraceLine(324,0,__PYX_ERR(0, 324, __pyx_L1_error))
5367 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_double(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 324, __pyx_L1_error)
5368 __pyx_v_array_parameters = __pyx_t_7;
5369 __pyx_t_7.memview = NULL;
5370 __pyx_t_7.data = NULL;
5379 __Pyx_TraceLine(325,0,__PYX_ERR(0, 325, __pyx_L1_error))
5381 __pyx_v_c_parameters = (&(*((
double *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
5392 __Pyx_TraceLine(328,0,__PYX_ERR(0, 328, __pyx_L1_error))
5394 __pyx_v_c_trace = (&(*((
double *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
5403 __Pyx_TraceLine(329,0,__PYX_ERR(0, 329, __pyx_L1_error))
5405 __pyx_v_c_error = (&(*((
double *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
5414 __Pyx_TraceLine(330,0,__PYX_ERR(0, 330, __pyx_L1_error))
5416 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
5425 __Pyx_TraceLine(331,0,__PYX_ERR(0, 331, __pyx_L1_error))
5427 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
5436 __Pyx_TraceLine(332,0,__PYX_ERR(0, 332, __pyx_L1_error))
5438 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
5447 __Pyx_TraceLine(333,0,__PYX_ERR(0, 333, __pyx_L1_error))
5449 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
5458 __Pyx_TraceLine(337,0,__PYX_ERR(0, 337, __pyx_L1_error))
5459 __pyx_v_c_samples = ((
double **)malloc(((
sizeof(
double)) * __pyx_v_max_num_samples)));
5468 __Pyx_TraceLine(339,0,__PYX_ERR(0, 339, __pyx_L1_error))
5469 __pyx_t_9 = __pyx_v_max_num_samples;
5470 __pyx_t_10 = __pyx_t_9;
5471 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5472 __pyx_v_i = __pyx_t_11;
5481 __Pyx_TraceLine(340,0,__PYX_ERR(0, 340, __pyx_L1_error))
5482 (__pyx_v_c_samples[__pyx_v_i]) = ((
double *)malloc(((
sizeof(
double *)) * __pyx_v_num_inquiries)));
5491 __Pyx_TraceLine(342,0,__PYX_ERR(0, 342, __pyx_L1_error))
5492 __pyx_t_12 = __pyx_v_num_inquiries;
5493 __pyx_t_13 = __pyx_t_12;
5494 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5495 __pyx_v_j = __pyx_t_14;
5504 __Pyx_TraceLine(343,0,__PYX_ERR(0, 343, __pyx_L1_error))
5505 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5516 __Pyx_TraceLine(346,0,__PYX_ERR(0, 346, __pyx_L1_error))
5517 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_double(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 346, __pyx_L1_error)
5518 __pyx_v_Aop_double = __pyx_t_15;
5527 __Pyx_TraceLine(348,0,__PYX_ERR(0, 348, __pyx_L1_error))
5528 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5537 __Pyx_TraceLine(352,0,__PYX_ERR(0, 352, __pyx_L1_error))
5538 __pyx_v_all_converged =
cTraceEstimator<double> ::c_trace_estimator(__pyx_v_Aop_double, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_exponent, ((__pyx_t_5imate_12_definitions_5types_FlagType
const )__pyx_v_symmetric), __pyx_v_reorthogonalize, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5547 __Pyx_TraceLine(380,0,__PYX_ERR(0, 380, __pyx_L1_error))
5548 __pyx_t_9 = __pyx_v_num_inquiries;
5549 __pyx_t_10 = __pyx_t_9;
5550 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5551 __pyx_v_j = __pyx_t_11;
5560 __Pyx_TraceLine(381,0,__PYX_ERR(0, 381, __pyx_L1_error))
5561 __pyx_t_8 = __pyx_v_j;
5562 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
5563 __pyx_t_17 = __pyx_t_16;
5564 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
5565 __pyx_v_i = __pyx_t_12;
5574 __Pyx_TraceLine(382,0,__PYX_ERR(0, 382, __pyx_L1_error))
5575 __pyx_t_8 = __pyx_v_i;
5576 __pyx_t_18 = __pyx_v_i;
5577 __pyx_t_19 = __pyx_v_j;
5578 *((
double *) ( ((
char *) (((
double *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
5589 __Pyx_TraceLine(387,0,__PYX_ERR(0, 387, __pyx_L1_error))
5590 __pyx_t_9 = __pyx_v_max_num_samples;
5591 __pyx_t_10 = __pyx_t_9;
5592 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5593 __pyx_v_i = __pyx_t_11;
5602 __Pyx_TraceLine(388,0,__PYX_ERR(0, 388, __pyx_L1_error))
5603 free((__pyx_v_c_samples[__pyx_v_i]));
5613 __Pyx_TraceLine(389,0,__PYX_ERR(0, 389, __pyx_L1_error))
5614 free(__pyx_v_c_samples);
5623 __Pyx_TraceLine(391,0,__PYX_ERR(0, 391, __pyx_L1_error))
5624 __pyx_r = __pyx_v_all_converged;
5637 __Pyx_XDECREF(__pyx_t_3);
5638 __Pyx_XDECREF(__pyx_t_4);
5639 __Pyx_XDECREF(__pyx_t_5);
5640 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
5641 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
5644 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
5645 __Pyx_TraceReturn(Py_None, 0);
5646 __Pyx_RefNannyFinishContext();
5658 static __pyx_t_5imate_12_definitions_5types_FlagType __pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator__pyc_trace_estimator_long_double(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *__pyx_v_Aop, PyObject *__pyx_v_parameters, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_inquiries,
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *__pyx_v_py_matrix_function,
long double const __pyx_v_exponent, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_symmetric, __pyx_t_5imate_12_definitions_5types_FlagType
const __pyx_v_reorthogonalize, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_lanczos_degree,
long double const __pyx_v_lanczos_tol, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_min_num_samples, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_max_num_samples,
long double const __pyx_v_error_atol,
long double const __pyx_v_error_rtol,
long double const __pyx_v_confidence_level,
long double const __pyx_v_outlier_significance_level, __pyx_t_5imate_12_definitions_5types_IndexType
const __pyx_v_num_threads, __Pyx_memviewslice __pyx_v_trace, __Pyx_memviewslice __pyx_v_error, __Pyx_memviewslice __pyx_v_samples, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_processed_samples_indices, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_samples_used, __pyx_t_5imate_12_definitions_5types_MemoryViewIndexType __pyx_v_num_outliers, __pyx_t_5imate_12_definitions_5types_MemoryViewFlagType __pyx_v_converged,
float &__pyx_v_alg_wall_time) {
5659 long double *__pyx_v_c_parameters;
5660 long double __pyx_v_scalar_parameters;
5661 __Pyx_memviewslice __pyx_v_array_parameters = { 0, 0, { 0 }, { 0 }, { 0 } };
5662 long double *__pyx_v_c_trace;
5663 long double *__pyx_v_c_error;
5664 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_processed_samples_indices;
5665 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_samples_used;
5666 __pyx_t_5imate_12_definitions_5types_IndexType *__pyx_v_c_num_outliers;
5667 __pyx_t_5imate_12_definitions_5types_FlagType *__pyx_v_c_converged;
5668 long double **__pyx_v_c_samples;
5669 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_i;
5670 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_v_j;
5673 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_v_all_converged;
5674 __pyx_t_5imate_12_definitions_5types_FlagType __pyx_r;
5675 __Pyx_TraceDeclarations
5676 __Pyx_RefNannyDeclarations
5679 PyObject *__pyx_t_3 = NULL;
5680 PyObject *__pyx_t_4 = NULL;
5681 PyObject *__pyx_t_5 = NULL;
5682 long double __pyx_t_6;
5683 __Pyx_memviewslice __pyx_t_7 = { 0, 0, { 0 }, { 0 }, { 0 } };
5684 Py_ssize_t __pyx_t_8;
5685 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_9;
5686 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_10;
5687 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_11;
5688 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_12;
5689 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_13;
5690 __pyx_t_5imate_12_definitions_5types_IndexType __pyx_t_14;
5694 Py_ssize_t __pyx_t_18;
5695 Py_ssize_t __pyx_t_19;
5696 int __pyx_lineno = 0;
5697 const char *__pyx_filename = NULL;
5698 int __pyx_clineno = 0;
5699 __Pyx_RefNannySetupContext(
"_pyc_trace_estimator_long_double", 0);
5700 __Pyx_TraceCall(
"_pyc_trace_estimator_long_double", __pyx_f[0], 398, 0, __PYX_ERR(0, 398, __pyx_L1_error));
5709 __Pyx_TraceLine(431,0,__PYX_ERR(0, 431, __pyx_L1_error))
5710 __pyx_t_1 = (__pyx_v_parameters == Py_None);
5711 __pyx_t_2 = (__pyx_t_1 != 0);
5721 __Pyx_TraceLine(432,0,__PYX_ERR(0, 432, __pyx_L1_error))
5722 __pyx_v_c_parameters = NULL;
5741 __Pyx_TraceLine(434,0,__PYX_ERR(0, 434, __pyx_L1_error))
5742 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_numpy);
if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 434, __pyx_L1_error)
5743 __Pyx_GOTREF(__pyx_t_4);
5744 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_isscalar);
if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 434, __pyx_L1_error)
5745 __Pyx_GOTREF(__pyx_t_5);
5746 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5748 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
5749 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
5750 if (likely(__pyx_t_4)) {
5751 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
5752 __Pyx_INCREF(__pyx_t_4);
5753 __Pyx_INCREF(
function);
5754 __Pyx_DECREF_SET(__pyx_t_5,
function);
5757 __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_parameters) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_parameters);
5758 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
5759 if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 434, __pyx_L1_error)
5760 __Pyx_GOTREF(__pyx_t_3);
5761 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5762 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 434, __pyx_L1_error)
5763 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5773 __Pyx_TraceLine(435,0,__PYX_ERR(0, 435, __pyx_L1_error))
5774 __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_parameters);
if (unlikely((__pyx_t_6 == (
long double)-1) && PyErr_Occurred())) __PYX_ERR(0, 435, __pyx_L1_error)
5775 __pyx_v_scalar_parameters = __pyx_t_6;
5784 __Pyx_TraceLine(436,0,__PYX_ERR(0, 436, __pyx_L1_error))
5785 __pyx_v_c_parameters = (&__pyx_v_scalar_parameters);
5804 __Pyx_TraceLine(439,0,__PYX_ERR(0, 439, __pyx_L1_error))
5806 __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(__pyx_v_parameters, PyBUF_WRITABLE);
if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 439, __pyx_L1_error)
5807 __pyx_v_array_parameters = __pyx_t_7;
5808 __pyx_t_7.memview = NULL;
5809 __pyx_t_7.data = NULL;
5818 __Pyx_TraceLine(440,0,__PYX_ERR(0, 440, __pyx_L1_error))
5820 __pyx_v_c_parameters = (&(*((
long double *) ( (__pyx_v_array_parameters.data + __pyx_t_8 * __pyx_v_array_parameters.strides[0]) ))));
5831 __Pyx_TraceLine(443,0,__PYX_ERR(0, 443, __pyx_L1_error))
5833 __pyx_v_c_trace = (&(*((
long double *) ( (__pyx_v_trace.data + __pyx_t_8 * __pyx_v_trace.strides[0]) ))));
5842 __Pyx_TraceLine(444,0,__PYX_ERR(0, 444, __pyx_L1_error))
5844 __pyx_v_c_error = (&(*((
long double *) ( (__pyx_v_error.data + __pyx_t_8 * __pyx_v_error.strides[0]) ))));
5853 __Pyx_TraceLine(445,0,__PYX_ERR(0, 445, __pyx_L1_error))
5855 __pyx_v_c_processed_samples_indices = (&(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) ))));
5864 __Pyx_TraceLine(446,0,__PYX_ERR(0, 446, __pyx_L1_error))
5866 __pyx_v_c_num_samples_used = (&(*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) ))));
5875 __Pyx_TraceLine(447,0,__PYX_ERR(0, 447, __pyx_L1_error))
5877 __pyx_v_c_num_outliers = (&(*((
int *) ( (__pyx_v_num_outliers.data + __pyx_t_8 * __pyx_v_num_outliers.strides[0]) ))));
5886 __Pyx_TraceLine(448,0,__PYX_ERR(0, 448, __pyx_L1_error))
5888 __pyx_v_c_converged = (&(*((
int *) ( (__pyx_v_converged.data + __pyx_t_8 * __pyx_v_converged.strides[0]) ))));
5897 __Pyx_TraceLine(452,0,__PYX_ERR(0, 452, __pyx_L1_error))
5898 __pyx_v_c_samples = ((
long double **)malloc(((
sizeof(
long double *)) * __pyx_v_max_num_samples)));
5907 __Pyx_TraceLine(454,0,__PYX_ERR(0, 454, __pyx_L1_error))
5908 __pyx_t_9 = __pyx_v_max_num_samples;
5909 __pyx_t_10 = __pyx_t_9;
5910 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5911 __pyx_v_i = __pyx_t_11;
5920 __Pyx_TraceLine(455,0,__PYX_ERR(0, 455, __pyx_L1_error))
5921 (__pyx_v_c_samples[__pyx_v_i]) = ((
long double *)malloc(((
sizeof(
long double)) * __pyx_v_num_inquiries)));
5930 __Pyx_TraceLine(458,0,__PYX_ERR(0, 458, __pyx_L1_error))
5931 __pyx_t_12 = __pyx_v_num_inquiries;
5932 __pyx_t_13 = __pyx_t_12;
5933 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
5934 __pyx_v_j = __pyx_t_14;
5943 __Pyx_TraceLine(459,0,__PYX_ERR(0, 459, __pyx_L1_error))
5944 ((__pyx_v_c_samples[__pyx_v_i])[__pyx_v_j]) = NAN;
5955 __Pyx_TraceLine(463,0,__PYX_ERR(0, 463, __pyx_L1_error))
5956 __pyx_t_15 = ((
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *)__pyx_v_Aop->__pyx_vtab)->get_linear_operator_long_double(__pyx_v_Aop);
if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 463, __pyx_L1_error)
5957 __pyx_v_Aop_long_double = __pyx_t_15;
5966 __Pyx_TraceLine(465,0,__PYX_ERR(0, 465, __pyx_L1_error))
5967 __pyx_v_matrix_function = ((
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction *)__pyx_v_py_matrix_function->__pyx_vtab)->get_function(__pyx_v_py_matrix_function);
5976 __Pyx_TraceLine(469,0,__PYX_ERR(0, 469, __pyx_L1_error))
5977 __pyx_v_all_converged =
cTraceEstimator<__pyx_t_5imate_18_c_trace_estimator_20py_c_trace_estimator_long_double> ::c_trace_estimator(__pyx_v_Aop_long_double, __pyx_v_c_parameters, __pyx_v_num_inquiries, __pyx_v_matrix_function, __pyx_v_exponent, ((__pyx_t_5imate_12_definitions_5types_FlagType
const )__pyx_v_symmetric), __pyx_v_reorthogonalize, __pyx_v_lanczos_degree, __pyx_v_lanczos_tol, __pyx_v_min_num_samples, __pyx_v_max_num_samples, __pyx_v_error_atol, __pyx_v_error_rtol, __pyx_v_confidence_level, __pyx_v_outlier_significance_level, __pyx_v_num_threads, __pyx_v_c_trace, __pyx_v_c_error, __pyx_v_c_samples, __pyx_v_c_processed_samples_indices, __pyx_v_c_num_samples_used, __pyx_v_c_num_outliers, __pyx_v_c_converged, __pyx_v_alg_wall_time);
5986 __Pyx_TraceLine(497,0,__PYX_ERR(0, 497, __pyx_L1_error))
5987 __pyx_t_9 = __pyx_v_num_inquiries;
5988 __pyx_t_10 = __pyx_t_9;
5989 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
5990 __pyx_v_j = __pyx_t_11;
5999 __Pyx_TraceLine(498,0,__PYX_ERR(0, 498, __pyx_L1_error))
6000 __pyx_t_8 = __pyx_v_j;
6001 __pyx_t_16 = (*((
int *) ( (__pyx_v_num_samples_used.data + __pyx_t_8 * __pyx_v_num_samples_used.strides[0]) )));
6002 __pyx_t_17 = __pyx_t_16;
6003 for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_17; __pyx_t_12+=1) {
6004 __pyx_v_i = __pyx_t_12;
6013 __Pyx_TraceLine(499,0,__PYX_ERR(0, 499, __pyx_L1_error))
6014 __pyx_t_8 = __pyx_v_i;
6015 __pyx_t_18 = __pyx_v_i;
6016 __pyx_t_19 = __pyx_v_j;
6017 *((
long double *) ( ((
char *) (((
long double *) ( (__pyx_v_samples.data + __pyx_t_18 * __pyx_v_samples.strides[0]) )) + __pyx_t_19)) )) = ((__pyx_v_c_samples[(*((
int *) ( (__pyx_v_processed_samples_indices.data + __pyx_t_8 * __pyx_v_processed_samples_indices.strides[0]) )))])[__pyx_v_j]);
6028 __Pyx_TraceLine(504,0,__PYX_ERR(0, 504, __pyx_L1_error))
6029 __pyx_t_9 = __pyx_v_max_num_samples;
6030 __pyx_t_10 = __pyx_t_9;
6031 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {
6032 __pyx_v_i = __pyx_t_11;
6041 __Pyx_TraceLine(505,0,__PYX_ERR(0, 505, __pyx_L1_error))
6042 free((__pyx_v_c_samples[__pyx_v_i]));
6052 __Pyx_TraceLine(506,0,__PYX_ERR(0, 506, __pyx_L1_error))
6053 free(__pyx_v_c_samples);
6060 __Pyx_TraceLine(508,0,__PYX_ERR(0, 508, __pyx_L1_error))
6061 __pyx_r = __pyx_v_all_converged;
6074 __Pyx_XDECREF(__pyx_t_3);
6075 __Pyx_XDECREF(__pyx_t_4);
6076 __Pyx_XDECREF(__pyx_t_5);
6077 __PYX_XDEC_MEMVIEW(&__pyx_t_7, 1);
6078 __Pyx_AddTraceback(
"imate._c_trace_estimator.py_c_trace_estimator._pyc_trace_estimator_long_double", __pyx_clineno, __pyx_lineno, __pyx_filename);
6081 __PYX_XDEC_MEMVIEW(&__pyx_v_array_parameters, 1);
6082 __Pyx_TraceReturn(Py_None, 0);
6083 __Pyx_RefNannyFinishContext();
6096 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
6097 static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6098 PyObject *__pyx_v_shape = 0;
6099 Py_ssize_t __pyx_v_itemsize;
6100 PyObject *__pyx_v_format = 0;
6101 PyObject *__pyx_v_mode = 0;
6102 int __pyx_v_allocate_buffer;
6103 int __pyx_lineno = 0;
6104 const char *__pyx_filename = NULL;
6105 int __pyx_clineno = 0;
6107 __Pyx_RefNannyDeclarations
6108 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
6110 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_shape,&__pyx_n_s_itemsize,&__pyx_n_s_format,&__pyx_n_s_mode,&__pyx_n_s_allocate_buffer,0};
6111 PyObject* values[5] = {0,0,0,0,0};
6112 values[3] = ((PyObject *)__pyx_n_s_c);
6113 if (unlikely(__pyx_kwds)) {
6115 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6117 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6119 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6121 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6123 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6125 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6128 default:
goto __pyx_L5_argtuple_error;
6130 kw_args = PyDict_Size(__pyx_kwds);
6133 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shape)) != 0)) kw_args--;
6134 else goto __pyx_L5_argtuple_error;
6137 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_itemsize)) != 0)) kw_args--;
6139 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 1); __PYX_ERR(2, 123, __pyx_L3_error)
6143 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_format)) != 0)) kw_args--;
6145 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, 2); __PYX_ERR(2, 123, __pyx_L3_error)
6150 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mode);
6151 if (value) { values[3] = value; kw_args--; }
6156 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_allocate_buffer);
6157 if (value) { values[4] = value; kw_args--; }
6160 if (unlikely(kw_args > 0)) {
6161 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 123, __pyx_L3_error)
6164 switch (PyTuple_GET_SIZE(__pyx_args)) {
6165 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
6167 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
6169 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6170 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6171 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6173 default:
goto __pyx_L5_argtuple_error;
6176 __pyx_v_shape = ((PyObject*)values[0]);
6177 __pyx_v_itemsize = __Pyx_PyIndex_AsSsize_t(values[1]);
if (unlikely((__pyx_v_itemsize == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 123, __pyx_L3_error)
6178 __pyx_v_format = values[2];
6179 __pyx_v_mode = values[3];
6181 __pyx_v_allocate_buffer = __Pyx_PyObject_IsTrue(values[4]);
if (unlikely((__pyx_v_allocate_buffer == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 124, __pyx_L3_error)
6191 __pyx_v_allocate_buffer = ((int)1);
6194 goto __pyx_L4_argument_unpacking_done;
6195 __pyx_L5_argtuple_error:;
6196 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 3, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 123, __pyx_L3_error)
6198 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6199 __Pyx_RefNannyFinishContext();
6201 __pyx_L4_argument_unpacking_done:;
6202 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_shape), (&PyTuple_Type), 1,
"shape", 1))) __PYX_ERR(2, 123, __pyx_L1_error)
6203 if (unlikely(((PyObject *)__pyx_v_format) == Py_None)) {
6204 PyErr_Format(PyExc_TypeError,
"Argument '%.200s' must not be None",
"format"); __PYX_ERR(2, 123, __pyx_L1_error)
6206 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(((
struct __pyx_array_obj *)__pyx_v_self), __pyx_v_shape, __pyx_v_itemsize, __pyx_v_format, __pyx_v_mode, __pyx_v_allocate_buffer);
6221 __Pyx_RefNannyFinishContext();
6225 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize, PyObject *__pyx_v_format, PyObject *__pyx_v_mode,
int __pyx_v_allocate_buffer) {
6227 Py_ssize_t __pyx_v_i;
6228 Py_ssize_t __pyx_v_dim;
6229 PyObject **__pyx_v_p;
6232 __Pyx_TraceDeclarations
6233 __Pyx_RefNannyDeclarations
6234 Py_ssize_t __pyx_t_1;
6236 PyObject *__pyx_t_3 = NULL;
6238 PyObject *__pyx_t_5 = NULL;
6239 PyObject *__pyx_t_6 = NULL;
6242 Py_ssize_t __pyx_t_9;
6243 PyObject *__pyx_t_10 = NULL;
6244 Py_ssize_t __pyx_t_11;
6245 int __pyx_lineno = 0;
6246 const char *__pyx_filename = NULL;
6247 int __pyx_clineno = 0;
6248 __Pyx_RefNannySetupContext(
"__cinit__", 0);
6249 __Pyx_TraceCall(
"__cinit__", __pyx_f[2], 123, 0, __PYX_ERR(2, 123, __pyx_L1_error));
6250 __Pyx_INCREF(__pyx_v_format);
6259 __Pyx_TraceLine(130,0,__PYX_ERR(2, 130, __pyx_L1_error))
6260 if (unlikely(__pyx_v_shape == Py_None)) {
6261 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
6262 __PYX_ERR(2, 130, __pyx_L1_error)
6264 __pyx_t_1 = PyTuple_GET_SIZE(__pyx_v_shape);
if (unlikely(__pyx_t_1 == ((Py_ssize_t)-1))) __PYX_ERR(2, 130, __pyx_L1_error)
6265 __pyx_v_self->ndim = ((int)__pyx_t_1);
6274 __Pyx_TraceLine(131,0,__PYX_ERR(2, 131, __pyx_L1_error))
6275 __pyx_v_self->itemsize = __pyx_v_itemsize;
6284 __Pyx_TraceLine(133,0,__PYX_ERR(2, 133, __pyx_L1_error))
6285 __pyx_t_2 = ((!(__pyx_v_self->ndim != 0)) != 0);
6286 if (unlikely(__pyx_t_2)) {
6295 __Pyx_TraceLine(134,0,__PYX_ERR(2, 134, __pyx_L1_error))
6296 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 134, __pyx_L1_error)
6297 __Pyx_GOTREF(__pyx_t_3);
6298 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6299 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6300 __PYX_ERR(2, 134, __pyx_L1_error)
6318 __Pyx_TraceLine(136,0,__PYX_ERR(2, 136, __pyx_L1_error))
6319 __pyx_t_2 = ((__pyx_v_itemsize <= 0) != 0);
6320 if (unlikely(__pyx_t_2)) {
6329 __Pyx_TraceLine(137,0,__PYX_ERR(2, 137, __pyx_L1_error))
6330 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 137, __pyx_L1_error)
6331 __Pyx_GOTREF(__pyx_t_3);
6332 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6333 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6334 __PYX_ERR(2, 137, __pyx_L1_error)
6352 __Pyx_TraceLine(139,0,__PYX_ERR(2, 139, __pyx_L1_error))
6353 __pyx_t_2 = PyBytes_Check(__pyx_v_format);
6354 __pyx_t_4 = ((!(__pyx_t_2 != 0)) != 0);
6364 __Pyx_TraceLine(140,0,__PYX_ERR(2, 140, __pyx_L1_error))
6365 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_format, __pyx_n_s_encode);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 140, __pyx_L1_error)
6366 __Pyx_GOTREF(__pyx_t_5);
6368 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
6369 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
6370 if (likely(__pyx_t_6)) {
6371 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
6372 __Pyx_INCREF(__pyx_t_6);
6373 __Pyx_INCREF(
function);
6374 __Pyx_DECREF_SET(__pyx_t_5,
function);
6377 __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_n_s_ASCII) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_n_s_ASCII);
6378 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
6379 if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 140, __pyx_L1_error)
6380 __Pyx_GOTREF(__pyx_t_3);
6381 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6382 __Pyx_DECREF_SET(__pyx_v_format, __pyx_t_3);
6401 __Pyx_TraceLine(141,0,__PYX_ERR(2, 141, __pyx_L1_error))
6402 if (!(likely(PyBytes_CheckExact(__pyx_v_format))||((__pyx_v_format) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_v_format)->tp_name), 0))) __PYX_ERR(2, 141, __pyx_L1_error)
6403 __pyx_t_3 = __pyx_v_format;
6404 __Pyx_INCREF(__pyx_t_3);
6405 __Pyx_GIVEREF(__pyx_t_3);
6406 __Pyx_GOTREF(__pyx_v_self->_format);
6407 __Pyx_DECREF(__pyx_v_self->_format);
6408 __pyx_v_self->_format = ((PyObject*)__pyx_t_3);
6418 __Pyx_TraceLine(142,0,__PYX_ERR(2, 142, __pyx_L1_error))
6419 if (unlikely(__pyx_v_self->_format == Py_None)) {
6420 PyErr_SetString(PyExc_TypeError,
"expected bytes, NoneType found");
6421 __PYX_ERR(2, 142, __pyx_L1_error)
6423 __pyx_t_7 = __Pyx_PyBytes_AsWritableString(__pyx_v_self->_format);
if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(2, 142, __pyx_L1_error)
6424 __pyx_v_self->format = __pyx_t_7;
6433 __Pyx_TraceLine(145,0,__PYX_ERR(2, 145, __pyx_L1_error))
6434 __pyx_v_self->_shape = ((Py_ssize_t *)PyObject_Malloc((((
sizeof(Py_ssize_t)) * __pyx_v_self->ndim) * 2)));
6443 __Pyx_TraceLine(146,0,__PYX_ERR(2, 146, __pyx_L1_error))
6444 __pyx_v_self->_strides = (__pyx_v_self->_shape + __pyx_v_self->ndim);
6453 __Pyx_TraceLine(148,0,__PYX_ERR(2, 148, __pyx_L1_error))
6454 __pyx_t_4 = ((!(__pyx_v_self->_shape != 0)) != 0);
6455 if (unlikely(__pyx_t_4)) {
6464 __Pyx_TraceLine(149,0,__PYX_ERR(2, 149, __pyx_L1_error))
6465 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__5, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 149, __pyx_L1_error)
6466 __Pyx_GOTREF(__pyx_t_3);
6467 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
6468 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6469 __PYX_ERR(2, 149, __pyx_L1_error)
6487 __Pyx_TraceLine(152,0,__PYX_ERR(2, 152, __pyx_L1_error))
6489 __pyx_t_3 = __pyx_v_shape; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
6491 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
6492 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6493 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++;
if (unlikely(0 < 0)) __PYX_ERR(2, 152, __pyx_L1_error)
6495 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 152, __pyx_L1_error)
6496 __Pyx_GOTREF(__pyx_t_5);
6498 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_5);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 152, __pyx_L1_error)
6499 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6500 __pyx_v_dim = __pyx_t_9;
6501 __pyx_v_idx = __pyx_t_8;
6502 __pyx_t_8 = (__pyx_t_8 + 1);
6511 __Pyx_TraceLine(153,0,__PYX_ERR(2, 153, __pyx_L1_error))
6512 __pyx_t_4 = ((__pyx_v_dim <= 0) != 0);
6513 if (unlikely(__pyx_t_4)) {
6522 __Pyx_TraceLine(154,0,__PYX_ERR(2, 154, __pyx_L1_error))
6523 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_idx);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 154, __pyx_L1_error)
6524 __Pyx_GOTREF(__pyx_t_5);
6525 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
6526 __Pyx_GOTREF(__pyx_t_6);
6527 __pyx_t_10 = PyTuple_New(2);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
6528 __Pyx_GOTREF(__pyx_t_10);
6529 __Pyx_GIVEREF(__pyx_t_5);
6530 PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5);
6531 __Pyx_GIVEREF(__pyx_t_6);
6532 PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6);
6535 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_t_10);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 154, __pyx_L1_error)
6536 __Pyx_GOTREF(__pyx_t_6);
6537 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6538 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_6);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 154, __pyx_L1_error)
6539 __Pyx_GOTREF(__pyx_t_10);
6540 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6541 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6542 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6543 __PYX_ERR(2, 154, __pyx_L1_error)
6561 __Pyx_TraceLine(155,0,__PYX_ERR(2, 155, __pyx_L1_error))
6562 (__pyx_v_self->_shape[__pyx_v_idx]) = __pyx_v_dim;
6571 __Pyx_TraceLine(152,0,__PYX_ERR(2, 152, __pyx_L1_error))
6573 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6582 __Pyx_TraceLine(158,0,__PYX_ERR(2, 158, __pyx_L1_error))
6583 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_fortran, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 158, __pyx_L1_error)
6593 __Pyx_TraceLine(159,0,__PYX_ERR(2, 159, __pyx_L1_error))
6594 __pyx_v_order =
'F';
6603 __Pyx_TraceLine(160,0,__PYX_ERR(2, 160, __pyx_L1_error))
6604 __Pyx_INCREF(__pyx_n_u_fortran);
6605 __Pyx_GIVEREF(__pyx_n_u_fortran);
6606 __Pyx_GOTREF(__pyx_v_self->mode);
6607 __Pyx_DECREF(__pyx_v_self->mode);
6608 __pyx_v_self->mode = __pyx_n_u_fortran;
6627 __Pyx_TraceLine(161,0,__PYX_ERR(2, 161, __pyx_L1_error))
6628 __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_v_mode, __pyx_n_s_c, Py_EQ));
if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(2, 161, __pyx_L1_error)
6629 if (likely(__pyx_t_4)) {
6638 __Pyx_TraceLine(162,0,__PYX_ERR(2, 162, __pyx_L1_error))
6639 __pyx_v_order =
'C';
6648 __Pyx_TraceLine(163,0,__PYX_ERR(2, 163, __pyx_L1_error))
6649 __Pyx_INCREF(__pyx_n_u_c);
6650 __Pyx_GIVEREF(__pyx_n_u_c);
6651 __Pyx_GOTREF(__pyx_v_self->mode);
6652 __Pyx_DECREF(__pyx_v_self->mode);
6653 __pyx_v_self->mode = __pyx_n_u_c;
6672 __Pyx_TraceLine(165,0,__PYX_ERR(2, 165, __pyx_L1_error))
6674 __pyx_t_3 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_v_mode);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 165, __pyx_L1_error)
6675 __Pyx_GOTREF(__pyx_t_3);
6676 __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 165, __pyx_L1_error)
6677 __Pyx_GOTREF(__pyx_t_10);
6678 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6679 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6680 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6681 __PYX_ERR(2, 165, __pyx_L1_error)
6692 __Pyx_TraceLine(167,0,__PYX_ERR(2, 167, __pyx_L1_error))
6693 __pyx_v_self->len = __pyx_fill_contig_strides_array(__pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_itemsize, __pyx_v_self->ndim, __pyx_v_order);
6702 __Pyx_TraceLine(170,0,__PYX_ERR(2, 170, __pyx_L1_error))
6703 __pyx_v_self->free_data = __pyx_v_allocate_buffer;
6712 __Pyx_TraceLine(171,0,__PYX_ERR(2, 171, __pyx_L1_error))
6713 __pyx_t_10 = PyObject_RichCompare(__pyx_v_format, __pyx_n_b_O, Py_EQ); __Pyx_XGOTREF(__pyx_t_10);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 171, __pyx_L1_error)
6714 __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_10);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 171, __pyx_L1_error)
6715 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6716 __pyx_v_self->dtype_is_object = __pyx_t_4;
6725 __Pyx_TraceLine(172,0,__PYX_ERR(2, 172, __pyx_L1_error))
6726 __pyx_t_4 = (__pyx_v_allocate_buffer != 0);
6736 __Pyx_TraceLine(175,0,__PYX_ERR(2, 175, __pyx_L1_error))
6737 __pyx_v_self->data = ((
char *)malloc(__pyx_v_self->len));
6746 __Pyx_TraceLine(176,0,__PYX_ERR(2, 176, __pyx_L1_error))
6747 __pyx_t_4 = ((!(__pyx_v_self->data != 0)) != 0);
6748 if (unlikely(__pyx_t_4)) {
6757 __Pyx_TraceLine(177,0,__PYX_ERR(2, 177, __pyx_L1_error))
6758 __pyx_t_10 = __Pyx_PyObject_Call(__pyx_builtin_MemoryError, __pyx_tuple__6, NULL);
if (unlikely(!__pyx_t_10)) __PYX_ERR(2, 177, __pyx_L1_error)
6759 __Pyx_GOTREF(__pyx_t_10);
6760 __Pyx_Raise(__pyx_t_10, 0, 0, 0);
6761 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
6762 __PYX_ERR(2, 177, __pyx_L1_error)
6780 __Pyx_TraceLine(179,0,__PYX_ERR(2, 179, __pyx_L1_error))
6781 __pyx_t_4 = (__pyx_v_self->dtype_is_object != 0);
6791 __Pyx_TraceLine(180,0,__PYX_ERR(2, 180, __pyx_L1_error))
6792 __pyx_v_p = ((PyObject **)__pyx_v_self->data);
6801 __Pyx_TraceLine(181,0,__PYX_ERR(2, 181, __pyx_L1_error))
6802 if (unlikely(__pyx_v_itemsize == 0)) {
6803 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
6804 __PYX_ERR(2, 181, __pyx_L1_error)
6806 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_self->len))) {
6807 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
6808 __PYX_ERR(2, 181, __pyx_L1_error)
6810 __pyx_t_1 = (__pyx_v_self->len / __pyx_v_itemsize);
6811 __pyx_t_9 = __pyx_t_1;
6812 for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_9; __pyx_t_11+=1) {
6813 __pyx_v_i = __pyx_t_11;
6822 __Pyx_TraceLine(182,0,__PYX_ERR(2, 182, __pyx_L1_error))
6823 (__pyx_v_p[__pyx_v_i]) = Py_None;
6832 __Pyx_TraceLine(183,0,__PYX_ERR(2, 183, __pyx_L1_error))
6866 __Pyx_XDECREF(__pyx_t_3);
6867 __Pyx_XDECREF(__pyx_t_5);
6868 __Pyx_XDECREF(__pyx_t_6);
6869 __Pyx_XDECREF(__pyx_t_10);
6870 __Pyx_AddTraceback(
"View.MemoryView.array.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
6873 __Pyx_XDECREF(__pyx_v_format);
6874 __Pyx_TraceReturn(Py_None, 0);
6875 __Pyx_RefNannyFinishContext();
6888 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
6889 static CYTHON_UNUSED
int __pyx_array_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6891 __Pyx_RefNannyDeclarations
6892 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
6893 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(((
struct __pyx_array_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
6896 __Pyx_RefNannyFinishContext();
6900 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(
struct __pyx_array_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
6901 int __pyx_v_bufmode;
6903 __Pyx_TraceDeclarations
6904 __Pyx_RefNannyDeclarations
6907 PyObject *__pyx_t_3 = NULL;
6909 Py_ssize_t __pyx_t_5;
6911 Py_ssize_t *__pyx_t_7;
6912 int __pyx_lineno = 0;
6913 const char *__pyx_filename = NULL;
6914 int __pyx_clineno = 0;
6915 if (__pyx_v_info == NULL) {
6916 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
6919 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
6920 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
6921 __Pyx_GIVEREF(__pyx_v_info->obj);
6922 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[2], 186, 0, __PYX_ERR(2, 186, __pyx_L1_error));
6931 __Pyx_TraceLine(187,0,__PYX_ERR(2, 187, __pyx_L1_error))
6932 __pyx_v_bufmode = -1;
6941 __Pyx_TraceLine(188,0,__PYX_ERR(2, 188, __pyx_L1_error))
6942 __pyx_t_1 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_c, Py_EQ));
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 188, __pyx_L1_error)
6943 __pyx_t_2 = (__pyx_t_1 != 0);
6953 __Pyx_TraceLine(189,0,__PYX_ERR(2, 189, __pyx_L1_error))
6954 __pyx_v_bufmode = (PyBUF_C_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
6973 __Pyx_TraceLine(190,0,__PYX_ERR(2, 190, __pyx_L1_error))
6974 __pyx_t_2 = (__Pyx_PyUnicode_Equals(__pyx_v_self->mode, __pyx_n_u_fortran, Py_EQ));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 190, __pyx_L1_error)
6975 __pyx_t_1 = (__pyx_t_2 != 0);
6985 __Pyx_TraceLine(191,0,__PYX_ERR(2, 191, __pyx_L1_error))
6986 __pyx_v_bufmode = (PyBUF_F_CONTIGUOUS | PyBUF_ANY_CONTIGUOUS);
7005 __Pyx_TraceLine(192,0,__PYX_ERR(2, 192, __pyx_L1_error))
7006 __pyx_t_1 = ((!((__pyx_v_flags & __pyx_v_bufmode) != 0)) != 0);
7007 if (unlikely(__pyx_t_1)) {
7016 __Pyx_TraceLine(193,0,__PYX_ERR(2, 193, __pyx_L1_error))
7017 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 193, __pyx_L1_error)
7018 __Pyx_GOTREF(__pyx_t_3);
7019 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
7020 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7021 __PYX_ERR(2, 193, __pyx_L1_error)
7039 __Pyx_TraceLine(194,0,__PYX_ERR(2, 194, __pyx_L1_error))
7040 __pyx_t_4 = __pyx_v_self->data;
7041 __pyx_v_info->buf = __pyx_t_4;
7050 __Pyx_TraceLine(195,0,__PYX_ERR(2, 195, __pyx_L1_error))
7051 __pyx_t_5 = __pyx_v_self->len;
7052 __pyx_v_info->len = __pyx_t_5;
7061 __Pyx_TraceLine(196,0,__PYX_ERR(2, 196, __pyx_L1_error))
7062 __pyx_t_6 = __pyx_v_self->ndim;
7063 __pyx_v_info->ndim = __pyx_t_6;
7072 __Pyx_TraceLine(197,0,__PYX_ERR(2, 197, __pyx_L1_error))
7073 __pyx_t_7 = __pyx_v_self->_shape;
7074 __pyx_v_info->shape = __pyx_t_7;
7083 __Pyx_TraceLine(198,0,__PYX_ERR(2, 198, __pyx_L1_error))
7084 __pyx_t_7 = __pyx_v_self->_strides;
7085 __pyx_v_info->strides = __pyx_t_7;
7094 __Pyx_TraceLine(199,0,__PYX_ERR(2, 199, __pyx_L1_error))
7095 __pyx_v_info->suboffsets = NULL;
7104 __Pyx_TraceLine(200,0,__PYX_ERR(2, 200, __pyx_L1_error))
7105 __pyx_t_5 = __pyx_v_self->itemsize;
7106 __pyx_v_info->itemsize = __pyx_t_5;
7115 __Pyx_TraceLine(201,0,__PYX_ERR(2, 201, __pyx_L1_error))
7116 __pyx_v_info->readonly = 0;
7125 __Pyx_TraceLine(203,0,__PYX_ERR(2, 203, __pyx_L1_error))
7126 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
7136 __Pyx_TraceLine(204,0,__PYX_ERR(2, 204, __pyx_L1_error))
7137 __pyx_t_4 = __pyx_v_self->format;
7138 __pyx_v_info->format = __pyx_t_4;
7157 __Pyx_TraceLine(206,0,__PYX_ERR(2, 206, __pyx_L1_error))
7159 __pyx_v_info->format = NULL;
7170 __Pyx_TraceLine(208,0,__PYX_ERR(2, 208, __pyx_L1_error))
7171 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7172 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7173 __Pyx_GOTREF(__pyx_v_info->obj);
7174 __Pyx_DECREF(__pyx_v_info->obj);
7175 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
7189 __Pyx_XDECREF(__pyx_t_3);
7190 __Pyx_AddTraceback(
"View.MemoryView.array.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7192 if (__pyx_v_info->obj != NULL) {
7193 __Pyx_GOTREF(__pyx_v_info->obj);
7194 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7198 if (__pyx_v_info->obj == Py_None) {
7199 __Pyx_GOTREF(__pyx_v_info->obj);
7200 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
7203 __Pyx_TraceReturn(Py_None, 0);
7204 __Pyx_RefNannyFinishContext();
7217 static void __pyx_array___dealloc__(PyObject *__pyx_v_self);
7218 static void __pyx_array___dealloc__(PyObject *__pyx_v_self) {
7219 __Pyx_RefNannyDeclarations
7220 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
7221 __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(((
struct __pyx_array_obj *)__pyx_v_self));
7224 __Pyx_RefNannyFinishContext();
7227 static void __pyx_array___pyx_pf_15View_dot_MemoryView_5array_4__dealloc__(
struct __pyx_array_obj *__pyx_v_self) {
7228 __Pyx_TraceDeclarations
7229 __Pyx_RefNannyDeclarations
7231 int __pyx_lineno = 0;
7232 const char *__pyx_filename = NULL;
7233 int __pyx_clineno = 0;
7234 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
7235 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 212, 0, __PYX_ERR(2, 212, __pyx_L1_error));
7244 __Pyx_TraceLine(213,0,__PYX_ERR(2, 213, __pyx_L1_error))
7245 __pyx_t_1 = ((__pyx_v_self->callback_free_data != NULL) != 0);
7255 __Pyx_TraceLine(214,0,__PYX_ERR(2, 214, __pyx_L1_error))
7256 __pyx_v_self->callback_free_data(__pyx_v_self->data);
7275 __Pyx_TraceLine(215,0,__PYX_ERR(2, 215, __pyx_L1_error))
7276 __pyx_t_1 = (__pyx_v_self->free_data != 0);
7286 __Pyx_TraceLine(216,0,__PYX_ERR(2, 216, __pyx_L1_error))
7287 __pyx_t_1 = (__pyx_v_self->dtype_is_object != 0);
7297 __Pyx_TraceLine(217,0,__PYX_ERR(2, 217, __pyx_L1_error))
7298 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_self->data, __pyx_v_self->_shape, __pyx_v_self->_strides, __pyx_v_self->ndim, 0);
7316 __Pyx_TraceLine(219,0,__PYX_ERR(2, 219, __pyx_L1_error))
7317 free(__pyx_v_self->data);
7336 __Pyx_TraceLine(220,0,__PYX_ERR(2, 220, __pyx_L1_error))
7337 PyObject_Free(__pyx_v_self->_shape);
7350 __Pyx_WriteUnraisable(
"View.MemoryView.array.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
7352 __Pyx_TraceReturn(Py_None, 0);
7353 __Pyx_RefNannyFinishContext();
7365 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self);
7366 static PyObject *__pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(PyObject *__pyx_v_self) {
7367 PyObject *__pyx_r = 0;
7368 __Pyx_RefNannyDeclarations
7369 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
7370 __pyx_r = __pyx_pf_15View_dot_MemoryView_5array_7memview___get__(((
struct __pyx_array_obj *)__pyx_v_self));
7373 __Pyx_RefNannyFinishContext();
7377 static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(
struct __pyx_array_obj *__pyx_v_self) {
7378 PyObject *__pyx_r = NULL;
7379 __Pyx_TraceDeclarations
7380 __Pyx_RefNannyDeclarations
7381 PyObject *__pyx_t_1 = NULL;
7382 int __pyx_lineno = 0;
7383 const char *__pyx_filename = NULL;
7384 int __pyx_clineno = 0;
7385 __Pyx_RefNannySetupContext(
"__get__", 0);
7386 __Pyx_TraceCall(
"__get__", __pyx_f[2], 223, 0, __PYX_ERR(2, 223, __pyx_L1_error));
7395 __Pyx_TraceLine(224,0,__PYX_ERR(2, 224, __pyx_L1_error))
7396 __Pyx_XDECREF(__pyx_r);
7397 __pyx_t_1 = ((
struct __pyx_vtabstruct_array *)__pyx_v_self->__pyx_vtab)->get_memview(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 224, __pyx_L1_error)
7398 __Pyx_GOTREF(__pyx_t_1);
7399 __pyx_r = __pyx_t_1;
7413 __Pyx_XDECREF(__pyx_t_1);
7414 __Pyx_AddTraceback(
"View.MemoryView.array.memview.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7417 __Pyx_XGIVEREF(__pyx_r);
7418 __Pyx_TraceReturn(__pyx_r, 0);
7419 __Pyx_RefNannyFinishContext();
7431 static PyObject *__pyx_array_get_memview(
struct __pyx_array_obj *__pyx_v_self) {
7433 PyObject *__pyx_r = NULL;
7434 __Pyx_TraceDeclarations
7435 __Pyx_RefNannyDeclarations
7436 PyObject *__pyx_t_1 = NULL;
7437 PyObject *__pyx_t_2 = NULL;
7438 PyObject *__pyx_t_3 = NULL;
7439 int __pyx_lineno = 0;
7440 const char *__pyx_filename = NULL;
7441 int __pyx_clineno = 0;
7442 __Pyx_RefNannySetupContext(
"get_memview", 0);
7443 __Pyx_TraceCall(
"get_memview", __pyx_f[2], 227, 0, __PYX_ERR(2, 227, __pyx_L1_error));
7452 __Pyx_TraceLine(228,0,__PYX_ERR(2, 228, __pyx_L1_error))
7453 __pyx_v_flags = ((PyBUF_ANY_CONTIGUOUS | PyBUF_FORMAT) | PyBUF_WRITABLE);
7462 __Pyx_TraceLine(229,0,__PYX_ERR(2, 229, __pyx_L1_error))
7463 __Pyx_XDECREF(__pyx_r);
7464 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 229, __pyx_L1_error)
7465 __Pyx_GOTREF(__pyx_t_1);
7466 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
7467 __Pyx_GOTREF(__pyx_t_2);
7468 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 229, __pyx_L1_error)
7469 __Pyx_GOTREF(__pyx_t_3);
7470 __Pyx_INCREF(((PyObject *)__pyx_v_self));
7471 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
7472 PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self));
7473 __Pyx_GIVEREF(__pyx_t_1);
7474 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
7475 __Pyx_GIVEREF(__pyx_t_2);
7476 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
7479 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 229, __pyx_L1_error)
7480 __Pyx_GOTREF(__pyx_t_2);
7481 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7482 __pyx_r = __pyx_t_2;
7496 __Pyx_XDECREF(__pyx_t_1);
7497 __Pyx_XDECREF(__pyx_t_2);
7498 __Pyx_XDECREF(__pyx_t_3);
7499 __Pyx_AddTraceback(
"View.MemoryView.array.get_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
7502 __Pyx_XGIVEREF(__pyx_r);
7503 __Pyx_TraceReturn(__pyx_r, 0);
7504 __Pyx_RefNannyFinishContext();
7517 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self);
7518 static Py_ssize_t __pyx_array___len__(PyObject *__pyx_v_self) {
7520 __Pyx_RefNannyDeclarations
7521 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
7522 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(((
struct __pyx_array_obj *)__pyx_v_self));
7525 __Pyx_RefNannyFinishContext();
7529 static Py_ssize_t __pyx_array___pyx_pf_15View_dot_MemoryView_5array_6__len__(
struct __pyx_array_obj *__pyx_v_self) {
7531 __Pyx_TraceDeclarations
7532 __Pyx_RefNannyDeclarations
7533 int __pyx_lineno = 0;
7534 const char *__pyx_filename = NULL;
7535 int __pyx_clineno = 0;
7536 __Pyx_RefNannySetupContext(
"__len__", 0);
7537 __Pyx_TraceCall(
"__len__", __pyx_f[2], 231, 0, __PYX_ERR(2, 231, __pyx_L1_error));
7546 __Pyx_TraceLine(232,0,__PYX_ERR(2, 232, __pyx_L1_error))
7547 __pyx_r = (__pyx_v_self->_shape[0]);
7560 __Pyx_AddTraceback(
"View.MemoryView.array.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7563 __Pyx_TraceReturn(Py_None, 0);
7564 __Pyx_RefNannyFinishContext();
7577 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr);
7578 static PyObject *__pyx_array___getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_attr) {
7579 PyObject *__pyx_r = 0;
7580 __Pyx_RefNannyDeclarations
7581 __Pyx_RefNannySetupContext(
"__getattr__ (wrapper)", 0);
7582 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_attr));
7585 __Pyx_RefNannyFinishContext();
7589 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_attr) {
7590 PyObject *__pyx_r = NULL;
7591 __Pyx_TraceDeclarations
7592 __Pyx_RefNannyDeclarations
7593 PyObject *__pyx_t_1 = NULL;
7594 PyObject *__pyx_t_2 = NULL;
7595 int __pyx_lineno = 0;
7596 const char *__pyx_filename = NULL;
7597 int __pyx_clineno = 0;
7598 __Pyx_RefNannySetupContext(
"__getattr__", 0);
7599 __Pyx_TraceCall(
"__getattr__", __pyx_f[2], 234, 0, __PYX_ERR(2, 234, __pyx_L1_error));
7608 __Pyx_TraceLine(235,0,__PYX_ERR(2, 235, __pyx_L1_error))
7609 __Pyx_XDECREF(__pyx_r);
7610 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 235, __pyx_L1_error)
7611 __Pyx_GOTREF(__pyx_t_1);
7612 __pyx_t_2 = __Pyx_GetAttr(__pyx_t_1, __pyx_v_attr);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 235, __pyx_L1_error)
7613 __Pyx_GOTREF(__pyx_t_2);
7614 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7615 __pyx_r = __pyx_t_2;
7629 __Pyx_XDECREF(__pyx_t_1);
7630 __Pyx_XDECREF(__pyx_t_2);
7631 __Pyx_AddTraceback(
"View.MemoryView.array.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7634 __Pyx_XGIVEREF(__pyx_r);
7635 __Pyx_TraceReturn(__pyx_r, 0);
7636 __Pyx_RefNannyFinishContext();
7649 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item);
7650 static PyObject *__pyx_array___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item) {
7651 PyObject *__pyx_r = 0;
7652 __Pyx_RefNannyDeclarations
7653 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
7654 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item));
7657 __Pyx_RefNannyFinishContext();
7661 static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item) {
7662 PyObject *__pyx_r = NULL;
7663 __Pyx_TraceDeclarations
7664 __Pyx_RefNannyDeclarations
7665 PyObject *__pyx_t_1 = NULL;
7666 PyObject *__pyx_t_2 = NULL;
7667 int __pyx_lineno = 0;
7668 const char *__pyx_filename = NULL;
7669 int __pyx_clineno = 0;
7670 __Pyx_RefNannySetupContext(
"__getitem__", 0);
7671 __Pyx_TraceCall(
"__getitem__", __pyx_f[2], 237, 0, __PYX_ERR(2, 237, __pyx_L1_error));
7680 __Pyx_TraceLine(238,0,__PYX_ERR(2, 238, __pyx_L1_error))
7681 __Pyx_XDECREF(__pyx_r);
7682 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 238, __pyx_L1_error)
7683 __Pyx_GOTREF(__pyx_t_1);
7684 __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_item);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 238, __pyx_L1_error)
7685 __Pyx_GOTREF(__pyx_t_2);
7686 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7687 __pyx_r = __pyx_t_2;
7701 __Pyx_XDECREF(__pyx_t_1);
7702 __Pyx_XDECREF(__pyx_t_2);
7703 __Pyx_AddTraceback(
"View.MemoryView.array.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7706 __Pyx_XGIVEREF(__pyx_r);
7707 __Pyx_TraceReturn(__pyx_r, 0);
7708 __Pyx_RefNannyFinishContext();
7721 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value);
7722 static int __pyx_array___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
7724 __Pyx_RefNannyDeclarations
7725 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
7726 __pyx_r = __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v_item), ((PyObject *)__pyx_v_value));
7729 __Pyx_RefNannyFinishContext();
7733 static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(
struct __pyx_array_obj *__pyx_v_self, PyObject *__pyx_v_item, PyObject *__pyx_v_value) {
7735 __Pyx_TraceDeclarations
7736 __Pyx_RefNannyDeclarations
7737 PyObject *__pyx_t_1 = NULL;
7738 int __pyx_lineno = 0;
7739 const char *__pyx_filename = NULL;
7740 int __pyx_clineno = 0;
7741 __Pyx_RefNannySetupContext(
"__setitem__", 0);
7742 __Pyx_TraceCall(
"__setitem__", __pyx_f[2], 240, 0, __PYX_ERR(2, 240, __pyx_L1_error));
7751 __Pyx_TraceLine(241,0,__PYX_ERR(2, 241, __pyx_L1_error))
7752 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_memview);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 241, __pyx_L1_error)
7753 __Pyx_GOTREF(__pyx_t_1);
7754 if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_item, __pyx_v_value) < 0)) __PYX_ERR(2, 241, __pyx_L1_error)
7755 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7769 __Pyx_XDECREF(__pyx_t_1);
7770 __Pyx_AddTraceback(
"View.MemoryView.array.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7773 __Pyx_TraceReturn(Py_None, 0);
7774 __Pyx_RefNannyFinishContext();
7785 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
7786 static PyMethodDef __pyx_mdef___pyx_array_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0};
7787 static PyObject *__pyx_pw___pyx_array_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
7788 PyObject *__pyx_r = 0;
7789 __Pyx_RefNannyDeclarations
7790 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
7791 __pyx_r = __pyx_pf___pyx_array___reduce_cython__(((
struct __pyx_array_obj *)__pyx_v_self));
7794 __Pyx_RefNannyFinishContext();
7798 static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self) {
7799 PyObject *__pyx_r = NULL;
7800 __Pyx_TraceDeclarations
7801 __Pyx_RefNannyDeclarations
7802 PyObject *__pyx_t_1 = NULL;
7803 int __pyx_lineno = 0;
7804 const char *__pyx_filename = NULL;
7805 int __pyx_clineno = 0;
7806 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
7807 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
7815 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
7816 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__8, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
7817 __Pyx_GOTREF(__pyx_t_1);
7818 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7819 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7820 __PYX_ERR(2, 2, __pyx_L1_error)
7830 __Pyx_XDECREF(__pyx_t_1);
7831 __Pyx_AddTraceback(
"View.MemoryView.array.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7833 __Pyx_XGIVEREF(__pyx_r);
7834 __Pyx_TraceReturn(__pyx_r, 0);
7835 __Pyx_RefNannyFinishContext();
7847 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
7848 static PyMethodDef __pyx_mdef___pyx_array_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0};
7849 static PyObject *__pyx_pw___pyx_array_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
7850 PyObject *__pyx_r = 0;
7851 __Pyx_RefNannyDeclarations
7852 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
7853 __pyx_r = __pyx_pf___pyx_array_2__setstate_cython__(((
struct __pyx_array_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
7856 __Pyx_RefNannyFinishContext();
7860 static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_array_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
7861 PyObject *__pyx_r = NULL;
7862 __Pyx_TraceDeclarations
7863 __Pyx_RefNannyDeclarations
7864 PyObject *__pyx_t_1 = NULL;
7865 int __pyx_lineno = 0;
7866 const char *__pyx_filename = NULL;
7867 int __pyx_clineno = 0;
7868 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
7869 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
7876 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
7877 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
7878 __Pyx_GOTREF(__pyx_t_1);
7879 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
7880 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7881 __PYX_ERR(2, 4, __pyx_L1_error)
7892 __Pyx_XDECREF(__pyx_t_1);
7893 __Pyx_AddTraceback(
"View.MemoryView.array.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
7895 __Pyx_XGIVEREF(__pyx_r);
7896 __Pyx_TraceReturn(__pyx_r, 0);
7897 __Pyx_RefNannyFinishContext();
7909 static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize_t __pyx_v_itemsize,
char *__pyx_v_format,
char *__pyx_v_mode,
char *__pyx_v_buf) {
7910 struct __pyx_array_obj *__pyx_v_result = 0;
7911 struct __pyx_array_obj *__pyx_r = NULL;
7912 __Pyx_TraceDeclarations
7913 __Pyx_RefNannyDeclarations
7915 PyObject *__pyx_t_2 = NULL;
7916 PyObject *__pyx_t_3 = NULL;
7917 PyObject *__pyx_t_4 = NULL;
7918 PyObject *__pyx_t_5 = NULL;
7919 int __pyx_lineno = 0;
7920 const char *__pyx_filename = NULL;
7921 int __pyx_clineno = 0;
7922 __Pyx_RefNannySetupContext(
"array_cwrapper", 0);
7923 __Pyx_TraceCall(
"array_cwrapper", __pyx_f[2], 245, 0, __PYX_ERR(2, 245, __pyx_L1_error));
7932 __Pyx_TraceLine(249,0,__PYX_ERR(2, 249, __pyx_L1_error))
7933 __pyx_t_1 = ((__pyx_v_buf == NULL) != 0);
7943 __Pyx_TraceLine(250,0,__PYX_ERR(2, 250, __pyx_L1_error))
7944 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 250, __pyx_L1_error)
7945 __Pyx_GOTREF(__pyx_t_2);
7946 __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 250, __pyx_L1_error)
7947 __Pyx_GOTREF(__pyx_t_3);
7948 __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
7949 __Pyx_GOTREF(__pyx_t_4);
7950 __pyx_t_5 = PyTuple_New(4);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 250, __pyx_L1_error)
7951 __Pyx_GOTREF(__pyx_t_5);
7952 __Pyx_INCREF(__pyx_v_shape);
7953 __Pyx_GIVEREF(__pyx_v_shape);
7954 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_shape);
7955 __Pyx_GIVEREF(__pyx_t_2);
7956 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
7957 __Pyx_GIVEREF(__pyx_t_3);
7958 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
7959 __Pyx_GIVEREF(__pyx_t_4);
7960 PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
7964 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_5, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 250, __pyx_L1_error)
7965 __Pyx_GOTREF(__pyx_t_4);
7966 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7967 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_4);
7987 __Pyx_TraceLine(252,0,__PYX_ERR(2, 252, __pyx_L1_error))
7989 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_itemsize);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 252, __pyx_L1_error)
7990 __Pyx_GOTREF(__pyx_t_4);
7991 __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_format);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
7992 __Pyx_GOTREF(__pyx_t_5);
7993 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_mode, 0, strlen(__pyx_v_mode), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 252, __pyx_L1_error)
7994 __Pyx_GOTREF(__pyx_t_3);
7995 __pyx_t_2 = PyTuple_New(4);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 252, __pyx_L1_error)
7996 __Pyx_GOTREF(__pyx_t_2);
7997 __Pyx_INCREF(__pyx_v_shape);
7998 __Pyx_GIVEREF(__pyx_v_shape);
7999 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shape);
8000 __Pyx_GIVEREF(__pyx_t_4);
8001 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4);
8002 __Pyx_GIVEREF(__pyx_t_5);
8003 PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5);
8004 __Pyx_GIVEREF(__pyx_t_3);
8005 PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_3);
8017 __Pyx_TraceLine(253,0,__PYX_ERR(2, 253, __pyx_L1_error))
8018 __pyx_t_3 = __Pyx_PyDict_NewPresized(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 253, __pyx_L1_error)
8019 __Pyx_GOTREF(__pyx_t_3);
8020 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_allocate_buffer, Py_False) < 0) __PYX_ERR(2, 253, __pyx_L1_error)
8029 __Pyx_TraceLine(252,0,__PYX_ERR(2, 252, __pyx_L1_error))
8030 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 252, __pyx_L1_error)
8031 __Pyx_GOTREF(__pyx_t_5);
8032 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
8033 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8034 __pyx_v_result = ((
struct __pyx_array_obj *)__pyx_t_5);
8044 __Pyx_TraceLine(254,0,__PYX_ERR(2, 254, __pyx_L1_error))
8045 __pyx_v_result->data = __pyx_v_buf;
8056 __Pyx_TraceLine(256,0,__PYX_ERR(2, 256, __pyx_L1_error))
8057 __Pyx_XDECREF(((PyObject *)__pyx_r));
8058 __Pyx_INCREF(((PyObject *)__pyx_v_result));
8059 __pyx_r = __pyx_v_result;
8072 __Pyx_XDECREF(__pyx_t_2);
8073 __Pyx_XDECREF(__pyx_t_3);
8074 __Pyx_XDECREF(__pyx_t_4);
8075 __Pyx_XDECREF(__pyx_t_5);
8076 __Pyx_AddTraceback(
"View.MemoryView.array_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
8079 __Pyx_XDECREF((PyObject *)__pyx_v_result);
8080 __Pyx_XGIVEREF((PyObject *)__pyx_r);
8081 __Pyx_TraceReturn(__pyx_r, 0);
8082 __Pyx_RefNannyFinishContext();
8095 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8096 static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8097 PyObject *__pyx_v_name = 0;
8098 int __pyx_lineno = 0;
8099 const char *__pyx_filename = NULL;
8100 int __pyx_clineno = 0;
8102 __Pyx_RefNannyDeclarations
8103 __Pyx_RefNannySetupContext(
"__init__ (wrapper)", 0);
8105 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
8106 PyObject* values[1] = {0};
8107 if (unlikely(__pyx_kwds)) {
8109 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8111 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8114 default:
goto __pyx_L5_argtuple_error;
8116 kw_args = PyDict_Size(__pyx_kwds);
8119 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
8120 else goto __pyx_L5_argtuple_error;
8122 if (unlikely(kw_args > 0)) {
8123 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__init__") < 0)) __PYX_ERR(2, 282, __pyx_L3_error)
8125 }
else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
8126 goto __pyx_L5_argtuple_error;
8128 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8130 __pyx_v_name = values[0];
8132 goto __pyx_L4_argument_unpacking_done;
8133 __pyx_L5_argtuple_error:;
8134 __Pyx_RaiseArgtupleInvalid(
"__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 282, __pyx_L3_error)
8136 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8137 __Pyx_RefNannyFinishContext();
8139 __pyx_L4_argument_unpacking_done:;
8140 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), __pyx_v_name);
8143 __Pyx_RefNannyFinishContext();
8147 static int __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum___init__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v_name) {
8149 __Pyx_TraceDeclarations
8150 __Pyx_RefNannyDeclarations
8151 int __pyx_lineno = 0;
8152 const char *__pyx_filename = NULL;
8153 int __pyx_clineno = 0;
8154 __Pyx_RefNannySetupContext(
"__init__", 0);
8155 __Pyx_TraceCall(
"__init__", __pyx_f[2], 282, 0, __PYX_ERR(2, 282, __pyx_L1_error));
8164 __Pyx_TraceLine(283,0,__PYX_ERR(2, 283, __pyx_L1_error))
8165 __Pyx_INCREF(__pyx_v_name);
8166 __Pyx_GIVEREF(__pyx_v_name);
8167 __Pyx_GOTREF(__pyx_v_self->name);
8168 __Pyx_DECREF(__pyx_v_self->name);
8169 __pyx_v_self->name = __pyx_v_name;
8183 __Pyx_AddTraceback(
"View.MemoryView.Enum.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8186 __Pyx_TraceReturn(Py_None, 0);
8187 __Pyx_RefNannyFinishContext();
8200 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self);
8201 static PyObject *__pyx_MemviewEnum___repr__(PyObject *__pyx_v_self) {
8202 PyObject *__pyx_r = 0;
8203 __Pyx_RefNannyDeclarations
8204 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
8205 __pyx_r = __pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8208 __Pyx_RefNannyFinishContext();
8212 static PyObject *__pyx_MemviewEnum___pyx_pf_15View_dot_MemoryView_4Enum_2__repr__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8213 PyObject *__pyx_r = NULL;
8214 __Pyx_TraceDeclarations
8215 __Pyx_RefNannyDeclarations
8216 int __pyx_lineno = 0;
8217 const char *__pyx_filename = NULL;
8218 int __pyx_clineno = 0;
8219 __Pyx_RefNannySetupContext(
"__repr__", 0);
8220 __Pyx_TraceCall(
"__repr__", __pyx_f[2], 284, 0, __PYX_ERR(2, 284, __pyx_L1_error));
8229 __Pyx_TraceLine(285,0,__PYX_ERR(2, 285, __pyx_L1_error))
8230 __Pyx_XDECREF(__pyx_r);
8231 __Pyx_INCREF(__pyx_v_self->name);
8232 __pyx_r = __pyx_v_self->name;
8245 __Pyx_AddTraceback(
"View.MemoryView.Enum.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8248 __Pyx_XGIVEREF(__pyx_r);
8249 __Pyx_TraceReturn(__pyx_r, 0);
8250 __Pyx_RefNannyFinishContext();
8261 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
8262 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0};
8263 static PyObject *__pyx_pw___pyx_MemviewEnum_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
8264 PyObject *__pyx_r = 0;
8265 __Pyx_RefNannyDeclarations
8266 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
8267 __pyx_r = __pyx_pf___pyx_MemviewEnum___reduce_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self));
8270 __Pyx_RefNannyFinishContext();
8274 static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self) {
8275 PyObject *__pyx_v_state = 0;
8276 PyObject *__pyx_v__dict = 0;
8277 int __pyx_v_use_setstate;
8278 PyObject *__pyx_r = NULL;
8279 __Pyx_TraceDeclarations
8280 __Pyx_RefNannyDeclarations
8281 PyObject *__pyx_t_1 = NULL;
8284 PyObject *__pyx_t_4 = NULL;
8285 PyObject *__pyx_t_5 = NULL;
8286 int __pyx_lineno = 0;
8287 const char *__pyx_filename = NULL;
8288 int __pyx_clineno = 0;
8289 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
8290 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
8299 __Pyx_TraceLine(5,0,__PYX_ERR(2, 5, __pyx_L1_error))
8300 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
8301 __Pyx_GOTREF(__pyx_t_1);
8302 __Pyx_INCREF(__pyx_v_self->name);
8303 __Pyx_GIVEREF(__pyx_v_self->name);
8304 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self->name);
8305 __pyx_v_state = ((PyObject*)__pyx_t_1);
8315 __Pyx_TraceLine(6,0,__PYX_ERR(2, 6, __pyx_L1_error))
8316 __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
8317 __Pyx_GOTREF(__pyx_t_1);
8318 __pyx_v__dict = __pyx_t_1;
8328 __Pyx_TraceLine(7,0,__PYX_ERR(2, 7, __pyx_L1_error))
8329 __pyx_t_2 = (__pyx_v__dict != Py_None);
8330 __pyx_t_3 = (__pyx_t_2 != 0);
8340 __Pyx_TraceLine(8,0,__PYX_ERR(2, 8, __pyx_L1_error))
8341 __pyx_t_1 = PyTuple_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 8, __pyx_L1_error)
8342 __Pyx_GOTREF(__pyx_t_1);
8343 __Pyx_INCREF(__pyx_v__dict);
8344 __Pyx_GIVEREF(__pyx_v__dict);
8345 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict);
8346 __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 8, __pyx_L1_error)
8347 __Pyx_GOTREF(__pyx_t_4);
8348 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8349 __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4));
8359 __Pyx_TraceLine(9,0,__PYX_ERR(2, 9, __pyx_L1_error))
8360 __pyx_v_use_setstate = 1;
8379 __Pyx_TraceLine(11,0,__PYX_ERR(2, 11, __pyx_L1_error))
8381 __pyx_t_3 = (__pyx_v_self->name != Py_None);
8382 __pyx_v_use_setstate = __pyx_t_3;
8393 __Pyx_TraceLine(12,0,__PYX_ERR(2, 12, __pyx_L1_error))
8394 __pyx_t_3 = (__pyx_v_use_setstate != 0);
8404 __Pyx_TraceLine(13,0,__PYX_ERR(2, 13, __pyx_L1_error))
8405 __Pyx_XDECREF(__pyx_r);
8406 __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 13, __pyx_L1_error)
8407 __Pyx_GOTREF(__pyx_t_4);
8408 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 13, __pyx_L1_error)
8409 __Pyx_GOTREF(__pyx_t_1);
8410 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8411 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8412 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8413 __Pyx_INCREF(__pyx_int_184977713);
8414 __Pyx_GIVEREF(__pyx_int_184977713);
8415 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8416 __Pyx_INCREF(Py_None);
8417 __Pyx_GIVEREF(Py_None);
8418 PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None);
8419 __pyx_t_5 = PyTuple_New(3);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 13, __pyx_L1_error)
8420 __Pyx_GOTREF(__pyx_t_5);
8421 __Pyx_GIVEREF(__pyx_t_4);
8422 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
8423 __Pyx_GIVEREF(__pyx_t_1);
8424 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1);
8425 __Pyx_INCREF(__pyx_v_state);
8426 __Pyx_GIVEREF(__pyx_v_state);
8427 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state);
8430 __pyx_r = __pyx_t_5;
8450 __Pyx_TraceLine(15,0,__PYX_ERR(2, 15, __pyx_L1_error))
8452 __Pyx_XDECREF(__pyx_r);
8453 __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle_Enum);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 15, __pyx_L1_error)
8454 __Pyx_GOTREF(__pyx_t_5);
8455 __pyx_t_1 = PyTuple_New(3);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 15, __pyx_L1_error)
8456 __Pyx_GOTREF(__pyx_t_1);
8457 __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8458 __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8459 PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))));
8460 __Pyx_INCREF(__pyx_int_184977713);
8461 __Pyx_GIVEREF(__pyx_int_184977713);
8462 PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_184977713);
8463 __Pyx_INCREF(__pyx_v_state);
8464 __Pyx_GIVEREF(__pyx_v_state);
8465 PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state);
8466 __pyx_t_4 = PyTuple_New(2);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 15, __pyx_L1_error)
8467 __Pyx_GOTREF(__pyx_t_4);
8468 __Pyx_GIVEREF(__pyx_t_5);
8469 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
8470 __Pyx_GIVEREF(__pyx_t_1);
8471 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
8474 __pyx_r = __pyx_t_4;
8487 __Pyx_XDECREF(__pyx_t_1);
8488 __Pyx_XDECREF(__pyx_t_4);
8489 __Pyx_XDECREF(__pyx_t_5);
8490 __Pyx_AddTraceback(
"View.MemoryView.Enum.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8493 __Pyx_XDECREF(__pyx_v_state);
8494 __Pyx_XDECREF(__pyx_v__dict);
8495 __Pyx_XGIVEREF(__pyx_r);
8496 __Pyx_TraceReturn(__pyx_r, 0);
8497 __Pyx_RefNannyFinishContext();
8509 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
8510 static PyMethodDef __pyx_mdef___pyx_MemviewEnum_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0};
8511 static PyObject *__pyx_pw___pyx_MemviewEnum_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8512 PyObject *__pyx_r = 0;
8513 __Pyx_RefNannyDeclarations
8514 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
8515 __pyx_r = __pyx_pf___pyx_MemviewEnum_2__setstate_cython__(((
struct __pyx_MemviewEnum_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
8518 __Pyx_RefNannyFinishContext();
8522 static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(
struct __pyx_MemviewEnum_obj *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
8523 PyObject *__pyx_r = NULL;
8524 __Pyx_TraceDeclarations
8525 __Pyx_RefNannyDeclarations
8526 PyObject *__pyx_t_1 = NULL;
8527 int __pyx_lineno = 0;
8528 const char *__pyx_filename = NULL;
8529 int __pyx_clineno = 0;
8530 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
8531 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 16, 0, __PYX_ERR(2, 16, __pyx_L1_error));
8538 __Pyx_TraceLine(17,0,__PYX_ERR(2, 17, __pyx_L1_error))
8539 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 17, __pyx_L1_error)
8540 __pyx_t_1 = __pyx_unpickle_Enum__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 17, __pyx_L1_error)
8541 __Pyx_GOTREF(__pyx_t_1);
8542 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8552 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
8555 __Pyx_XDECREF(__pyx_t_1);
8556 __Pyx_AddTraceback(
"View.MemoryView.Enum.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8559 __Pyx_XGIVEREF(__pyx_r);
8560 __Pyx_TraceReturn(__pyx_r, 0);
8561 __Pyx_RefNannyFinishContext();
8573 static void *__pyx_align_pointer(
void *__pyx_v_memory,
size_t __pyx_v_alignment) {
8574 Py_intptr_t __pyx_v_aligned_p;
8575 size_t __pyx_v_offset;
8577 __Pyx_TraceDeclarations
8579 int __pyx_lineno = 0;
8580 const char *__pyx_filename = NULL;
8581 int __pyx_clineno = 0;
8582 __Pyx_TraceCall(
"align_pointer", __pyx_f[2], 299, 1, __PYX_ERR(2, 299, __pyx_L1_error));
8591 __Pyx_TraceLine(301,1,__PYX_ERR(2, 301, __pyx_L1_error))
8592 __pyx_v_aligned_p = ((Py_intptr_t)__pyx_v_memory);
8601 __pyx_v_offset = (__pyx_v_aligned_p % __pyx_v_alignment);
8610 __Pyx_TraceLine(307,1,__PYX_ERR(2, 307, __pyx_L1_error))
8611 __pyx_t_1 = ((__pyx_v_offset > 0) != 0);
8621 __Pyx_TraceLine(308,1,__PYX_ERR(2, 308, __pyx_L1_error))
8622 __pyx_v_aligned_p = (__pyx_v_aligned_p + (__pyx_v_alignment - __pyx_v_offset));
8640 __Pyx_TraceLine(310,1,__PYX_ERR(2, 310, __pyx_L1_error))
8641 __pyx_r = ((
void *)__pyx_v_aligned_p);
8654 __Pyx_WriteUnraisable(
"View.MemoryView.align_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
8657 __Pyx_TraceReturn(Py_None, 1);
8670 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
8671 static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
8672 PyObject *__pyx_v_obj = 0;
8674 int __pyx_v_dtype_is_object;
8675 int __pyx_lineno = 0;
8676 const char *__pyx_filename = NULL;
8677 int __pyx_clineno = 0;
8679 __Pyx_RefNannyDeclarations
8680 __Pyx_RefNannySetupContext(
"__cinit__ (wrapper)", 0);
8682 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_obj,&__pyx_n_s_flags,&__pyx_n_s_dtype_is_object,0};
8683 PyObject* values[3] = {0,0,0};
8684 if (unlikely(__pyx_kwds)) {
8686 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
8688 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8690 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8692 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8695 default:
goto __pyx_L5_argtuple_error;
8697 kw_args = PyDict_Size(__pyx_kwds);
8700 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_obj)) != 0)) kw_args--;
8701 else goto __pyx_L5_argtuple_error;
8704 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_flags)) != 0)) kw_args--;
8706 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, 1); __PYX_ERR(2, 346, __pyx_L3_error)
8711 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dtype_is_object);
8712 if (value) { values[2] = value; kw_args--; }
8715 if (unlikely(kw_args > 0)) {
8716 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__cinit__") < 0)) __PYX_ERR(2, 346, __pyx_L3_error)
8719 switch (PyTuple_GET_SIZE(__pyx_args)) {
8720 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
8722 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
8723 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
8725 default:
goto __pyx_L5_argtuple_error;
8728 __pyx_v_obj = values[0];
8729 __pyx_v_flags = __Pyx_PyInt_As_int(values[1]);
if (unlikely((__pyx_v_flags == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
8731 __pyx_v_dtype_is_object = __Pyx_PyObject_IsTrue(values[2]);
if (unlikely((__pyx_v_dtype_is_object == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 346, __pyx_L3_error)
8733 __pyx_v_dtype_is_object = ((int)0);
8736 goto __pyx_L4_argument_unpacking_done;
8737 __pyx_L5_argtuple_error:;
8738 __Pyx_RaiseArgtupleInvalid(
"__cinit__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 346, __pyx_L3_error)
8740 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
8741 __Pyx_RefNannyFinishContext();
8743 __pyx_L4_argument_unpacking_done:;
8744 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_obj, __pyx_v_flags, __pyx_v_dtype_is_object);
8747 __Pyx_RefNannyFinishContext();
8751 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj,
int __pyx_v_flags,
int __pyx_v_dtype_is_object) {
8753 __Pyx_TraceDeclarations
8754 __Pyx_RefNannyDeclarations
8759 int __pyx_lineno = 0;
8760 const char *__pyx_filename = NULL;
8761 int __pyx_clineno = 0;
8762 __Pyx_RefNannySetupContext(
"__cinit__", 0);
8763 __Pyx_TraceCall(
"__cinit__", __pyx_f[2], 346, 0, __PYX_ERR(2, 346, __pyx_L1_error));
8772 __Pyx_TraceLine(347,0,__PYX_ERR(2, 347, __pyx_L1_error))
8773 __Pyx_INCREF(__pyx_v_obj);
8774 __Pyx_GIVEREF(__pyx_v_obj);
8775 __Pyx_GOTREF(__pyx_v_self->obj);
8776 __Pyx_DECREF(__pyx_v_self->obj);
8777 __pyx_v_self->obj = __pyx_v_obj;
8786 __Pyx_TraceLine(348,0,__PYX_ERR(2, 348, __pyx_L1_error))
8787 __pyx_v_self->flags = __pyx_v_flags;
8796 __Pyx_TraceLine(349,0,__PYX_ERR(2, 349, __pyx_L1_error))
8797 __pyx_t_2 = (((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self))) == ((PyObject *)__pyx_memoryview_type));
8798 __pyx_t_3 = (__pyx_t_2 != 0);
8801 __pyx_t_1 = __pyx_t_3;
8802 goto __pyx_L4_bool_binop_done;
8804 __pyx_t_3 = (__pyx_v_obj != Py_None);
8805 __pyx_t_2 = (__pyx_t_3 != 0);
8806 __pyx_t_1 = __pyx_t_2;
8807 __pyx_L4_bool_binop_done:;
8817 __Pyx_TraceLine(350,0,__PYX_ERR(2, 350, __pyx_L1_error))
8818 __pyx_t_4 = __Pyx_GetBuffer(__pyx_v_obj, (&__pyx_v_self->view), __pyx_v_flags);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 350, __pyx_L1_error)
8827 __Pyx_TraceLine(351,0,__PYX_ERR(2, 351, __pyx_L1_error))
8828 __pyx_t_1 = ((((PyObject *)__pyx_v_self->view.obj) == NULL) != 0);
8838 __Pyx_TraceLine(352,0,__PYX_ERR(2, 352, __pyx_L1_error))
8839 ((Py_buffer *)(&__pyx_v_self->view))->obj = Py_None;
8848 __Pyx_TraceLine(353,0,__PYX_ERR(2, 353, __pyx_L1_error))
8876 __Pyx_TraceLine(355,0,__PYX_ERR(2, 355, __pyx_L1_error))
8877 __pyx_t_1 = ((!(__PYX_CYTHON_ATOMICS_ENABLED() != 0)) != 0);
8887 __Pyx_TraceLine(357,0,__PYX_ERR(2, 357, __pyx_L1_error))
8888 __pyx_t_1 = ((__pyx_memoryview_thread_locks_used < 8) != 0);
8898 __Pyx_TraceLine(358,0,__PYX_ERR(2, 358, __pyx_L1_error))
8899 __pyx_v_self->lock = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
8908 __Pyx_TraceLine(359,0,__PYX_ERR(2, 359, __pyx_L1_error))
8909 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used + 1);
8927 __Pyx_TraceLine(360,0,__PYX_ERR(2, 360, __pyx_L1_error))
8928 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8938 __Pyx_TraceLine(361,0,__PYX_ERR(2, 361, __pyx_L1_error))
8939 __pyx_v_self->lock = PyThread_allocate_lock();
8948 __Pyx_TraceLine(362,0,__PYX_ERR(2, 362, __pyx_L1_error))
8949 __pyx_t_1 = ((__pyx_v_self->lock == NULL) != 0);
8950 if (unlikely(__pyx_t_1)) {
8959 __Pyx_TraceLine(363,0,__PYX_ERR(2, 363, __pyx_L1_error))
8960 PyErr_NoMemory(); __PYX_ERR(2, 363, __pyx_L1_error)
8996 __Pyx_TraceLine(365,0,__PYX_ERR(2, 365, __pyx_L1_error))
8997 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
9007 __Pyx_TraceLine(366,0,__PYX_ERR(2, 366, __pyx_L1_error))
9008 __pyx_t_2 = (((__pyx_v_self->view.format[0]) ==
'O') != 0);
9011 __pyx_t_1 = __pyx_t_2;
9012 goto __pyx_L12_bool_binop_done;
9014 __pyx_t_2 = (((__pyx_v_self->view.format[1]) ==
'\x00') != 0);
9015 __pyx_t_1 = __pyx_t_2;
9016 __pyx_L12_bool_binop_done:;
9017 __pyx_v_self->dtype_is_object = __pyx_t_1;
9036 __Pyx_TraceLine(368,0,__PYX_ERR(2, 368, __pyx_L1_error))
9038 __pyx_v_self->dtype_is_object = __pyx_v_dtype_is_object;
9049 __Pyx_TraceLine(370,0,__PYX_ERR(2, 370, __pyx_L1_error))
9050 __pyx_v_self->acquisition_count_aligned_p = ((__pyx_atomic_int *)__pyx_align_pointer(((
void *)(&(__pyx_v_self->acquisition_count[0]))), (
sizeof(__pyx_atomic_int))));
9059 __Pyx_TraceLine(372,0,__PYX_ERR(2, 372, __pyx_L1_error))
9060 __pyx_v_self->typeinfo = NULL;
9074 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9077 __Pyx_TraceReturn(Py_None, 0);
9078 __Pyx_RefNannyFinishContext();
9091 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self);
9092 static void __pyx_memoryview___dealloc__(PyObject *__pyx_v_self) {
9093 __Pyx_RefNannyDeclarations
9094 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
9095 __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
9098 __Pyx_RefNannyFinishContext();
9101 static void __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_2__dealloc__(
struct __pyx_memoryview_obj *__pyx_v_self) {
9103 __Pyx_TraceDeclarations
9104 __Pyx_RefNannyDeclarations
9110 PyThread_type_lock __pyx_t_6;
9111 PyThread_type_lock __pyx_t_7;
9112 int __pyx_lineno = 0;
9113 const char *__pyx_filename = NULL;
9114 int __pyx_clineno = 0;
9115 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
9116 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 374, 0, __PYX_ERR(2, 374, __pyx_L1_error));
9125 __Pyx_TraceLine(375,0,__PYX_ERR(2, 375, __pyx_L1_error))
9126 __pyx_t_1 = (__pyx_v_self->obj != Py_None);
9127 __pyx_t_2 = (__pyx_t_1 != 0);
9137 __Pyx_TraceLine(376,0,__PYX_ERR(2, 376, __pyx_L1_error))
9138 __Pyx_ReleaseBuffer((&__pyx_v_self->view));
9157 __Pyx_TraceLine(377,0,__PYX_ERR(2, 377, __pyx_L1_error))
9158 __pyx_t_2 = ((((Py_buffer *)(&__pyx_v_self->view))->obj == Py_None) != 0);
9168 __Pyx_TraceLine(379,0,__PYX_ERR(2, 379, __pyx_L1_error))
9169 ((Py_buffer *)(&__pyx_v_self->view))->obj = NULL;
9178 __Pyx_TraceLine(380,0,__PYX_ERR(2, 380, __pyx_L1_error))
9198 __Pyx_TraceLine(384,0,__PYX_ERR(2, 384, __pyx_L1_error))
9199 __pyx_t_2 = ((__pyx_v_self->lock != NULL) != 0);
9209 __Pyx_TraceLine(385,0,__PYX_ERR(2, 385, __pyx_L1_error))
9210 __pyx_t_3 = __pyx_memoryview_thread_locks_used;
9211 __pyx_t_4 = __pyx_t_3;
9212 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
9213 __pyx_v_i = __pyx_t_5;
9222 __Pyx_TraceLine(386,0,__PYX_ERR(2, 386, __pyx_L1_error))
9223 __pyx_t_2 = (((__pyx_memoryview_thread_locks[__pyx_v_i]) == __pyx_v_self->lock) != 0);
9233 __Pyx_TraceLine(387,0,__PYX_ERR(2, 387, __pyx_L1_error))
9234 __pyx_memoryview_thread_locks_used = (__pyx_memoryview_thread_locks_used - 1);
9243 __Pyx_TraceLine(388,0,__PYX_ERR(2, 388, __pyx_L1_error))
9244 __pyx_t_2 = ((__pyx_v_i != __pyx_memoryview_thread_locks_used) != 0);
9254 __Pyx_TraceLine(390,0,__PYX_ERR(2, 390, __pyx_L1_error))
9255 __pyx_t_6 = (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]);
9256 __pyx_t_7 = (__pyx_memoryview_thread_locks[__pyx_v_i]);
9265 __Pyx_TraceLine(389,0,__PYX_ERR(2, 389, __pyx_L1_error))
9266 (__pyx_memoryview_thread_locks[__pyx_v_i]) = __pyx_t_6;
9267 (__pyx_memoryview_thread_locks[__pyx_memoryview_thread_locks_used]) = __pyx_t_7;
9285 __Pyx_TraceLine(391,0,__PYX_ERR(2, 391, __pyx_L1_error))
9286 goto __pyx_L6_break;
9306 __Pyx_TraceLine(393,0,__PYX_ERR(2, 393, __pyx_L1_error))
9307 PyThread_free_lock(__pyx_v_self->lock);
9331 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
9333 __Pyx_TraceReturn(Py_None, 0);
9334 __Pyx_RefNannyFinishContext();
9345 static char *__pyx_memoryview_get_item_pointer(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9346 Py_ssize_t __pyx_v_dim;
9347 char *__pyx_v_itemp;
9348 PyObject *__pyx_v_idx = NULL;
9350 __Pyx_TraceDeclarations
9351 __Pyx_RefNannyDeclarations
9352 Py_ssize_t __pyx_t_1;
9353 PyObject *__pyx_t_2 = NULL;
9354 Py_ssize_t __pyx_t_3;
9355 PyObject *(*__pyx_t_4)(PyObject *);
9356 PyObject *__pyx_t_5 = NULL;
9357 Py_ssize_t __pyx_t_6;
9359 int __pyx_lineno = 0;
9360 const char *__pyx_filename = NULL;
9361 int __pyx_clineno = 0;
9362 __Pyx_RefNannySetupContext(
"get_item_pointer", 0);
9363 __Pyx_TraceCall(
"get_item_pointer", __pyx_f[2], 395, 0, __PYX_ERR(2, 395, __pyx_L1_error));
9372 __Pyx_TraceLine(397,0,__PYX_ERR(2, 397, __pyx_L1_error))
9373 __pyx_v_itemp = ((
char *)__pyx_v_self->view.buf);
9382 __Pyx_TraceLine(399,0,__PYX_ERR(2, 399, __pyx_L1_error))
9384 if (likely(PyList_CheckExact(__pyx_v_index)) || PyTuple_CheckExact(__pyx_v_index)) {
9385 __pyx_t_2 = __pyx_v_index; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0;
9388 __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 399, __pyx_L1_error)
9389 __Pyx_GOTREF(__pyx_t_2);
9390 __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext;
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 399, __pyx_L1_error)
9393 if (likely(!__pyx_t_4)) {
9394 if (likely(PyList_CheckExact(__pyx_t_2))) {
9395 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2))
break;
9396 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9397 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
9399 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
9400 __Pyx_GOTREF(__pyx_t_5);
9403 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2))
break;
9404 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9405 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++;
if (unlikely(0 < 0)) __PYX_ERR(2, 399, __pyx_L1_error)
9407 __pyx_t_5 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++;
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 399, __pyx_L1_error)
9408 __Pyx_GOTREF(__pyx_t_5);
9412 __pyx_t_5 = __pyx_t_4(__pyx_t_2);
9413 if (unlikely(!__pyx_t_5)) {
9414 PyObject* exc_type = PyErr_Occurred();
9416 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
9417 else __PYX_ERR(2, 399, __pyx_L1_error)
9421 __Pyx_GOTREF(__pyx_t_5);
9423 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_5);
9425 __pyx_v_dim = __pyx_t_1;
9426 __pyx_t_1 = (__pyx_t_1 + 1);
9435 __Pyx_TraceLine(400,0,__PYX_ERR(2, 400, __pyx_L1_error))
9436 __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_idx);
if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 400, __pyx_L1_error)
9437 __pyx_t_7 = __pyx_pybuffer_index((&__pyx_v_self->view), __pyx_v_itemp, __pyx_t_6, __pyx_v_dim);
if (unlikely(__pyx_t_7 == ((
char *)NULL))) __PYX_ERR(2, 400, __pyx_L1_error)
9438 __pyx_v_itemp = __pyx_t_7;
9447 __Pyx_TraceLine(399,0,__PYX_ERR(2, 399, __pyx_L1_error))
9449 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9458 __Pyx_TraceLine(402,0,__PYX_ERR(2, 402, __pyx_L1_error))
9459 __pyx_r = __pyx_v_itemp;
9472 __Pyx_XDECREF(__pyx_t_2);
9473 __Pyx_XDECREF(__pyx_t_5);
9474 __Pyx_AddTraceback(
"View.MemoryView.memoryview.get_item_pointer", __pyx_clineno, __pyx_lineno, __pyx_filename);
9477 __Pyx_XDECREF(__pyx_v_idx);
9478 __Pyx_TraceReturn(Py_None, 0);
9479 __Pyx_RefNannyFinishContext();
9492 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index);
9493 static PyObject *__pyx_memoryview___getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index) {
9494 PyObject *__pyx_r = 0;
9495 __Pyx_RefNannyDeclarations
9496 __Pyx_RefNannySetupContext(
"__getitem__ (wrapper)", 0);
9497 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index));
9500 __Pyx_RefNannyFinishContext();
9504 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4__getitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index) {
9505 PyObject *__pyx_v_have_slices = NULL;
9506 PyObject *__pyx_v_indices = NULL;
9507 char *__pyx_v_itemp;
9508 PyObject *__pyx_r = NULL;
9509 __Pyx_TraceDeclarations
9510 __Pyx_RefNannyDeclarations
9513 PyObject *__pyx_t_3 = NULL;
9514 PyObject *__pyx_t_4 = NULL;
9515 PyObject *__pyx_t_5 = NULL;
9517 int __pyx_lineno = 0;
9518 const char *__pyx_filename = NULL;
9519 int __pyx_clineno = 0;
9520 __Pyx_RefNannySetupContext(
"__getitem__", 0);
9521 __Pyx_TraceCall(
"__getitem__", __pyx_f[2], 405, 0, __PYX_ERR(2, 405, __pyx_L1_error));
9530 __Pyx_TraceLine(406,0,__PYX_ERR(2, 406, __pyx_L1_error))
9531 __pyx_t_1 = (__pyx_v_index == __pyx_builtin_Ellipsis);
9532 __pyx_t_2 = (__pyx_t_1 != 0);
9542 __Pyx_TraceLine(407,0,__PYX_ERR(2, 407, __pyx_L1_error))
9543 __Pyx_XDECREF(__pyx_r);
9544 __Pyx_INCREF(((PyObject *)__pyx_v_self));
9545 __pyx_r = ((PyObject *)__pyx_v_self);
9564 __Pyx_TraceLine(409,0,__PYX_ERR(2, 409, __pyx_L1_error))
9565 __pyx_t_3 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 409, __pyx_L1_error)
9566 __Pyx_GOTREF(__pyx_t_3);
9567 if (likely(__pyx_t_3 != Py_None)) {
9568 PyObject* sequence = __pyx_t_3;
9569 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9570 if (unlikely(size != 2)) {
9571 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9572 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9573 __PYX_ERR(2, 409, __pyx_L1_error)
9575 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9576 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0);
9577 __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1);
9578 __Pyx_INCREF(__pyx_t_4);
9579 __Pyx_INCREF(__pyx_t_5);
9581 __pyx_t_4 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 409, __pyx_L1_error)
9582 __Pyx_GOTREF(__pyx_t_4);
9583 __pyx_t_5 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 409, __pyx_L1_error)
9584 __Pyx_GOTREF(__pyx_t_5);
9586 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9588 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 409, __pyx_L1_error)
9590 __pyx_v_have_slices = __pyx_t_4;
9592 __pyx_v_indices = __pyx_t_5;
9602 __Pyx_TraceLine(412,0,__PYX_ERR(2, 412, __pyx_L1_error))
9603 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 412, __pyx_L1_error)
9613 __Pyx_TraceLine(413,0,__PYX_ERR(2, 413, __pyx_L1_error))
9614 __Pyx_XDECREF(__pyx_r);
9615 __pyx_t_3 = ((PyObject *)__pyx_memview_slice(__pyx_v_self, __pyx_v_indices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 413, __pyx_L1_error)
9616 __Pyx_GOTREF(__pyx_t_3);
9617 __pyx_r = __pyx_t_3;
9637 __Pyx_TraceLine(415,0,__PYX_ERR(2, 415, __pyx_L1_error))
9639 __pyx_t_6 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_indices);
if (unlikely(__pyx_t_6 == ((
char *)NULL))) __PYX_ERR(2, 415, __pyx_L1_error)
9640 __pyx_v_itemp = __pyx_t_6;
9649 __Pyx_TraceLine(416,0,__PYX_ERR(2, 416, __pyx_L1_error))
9650 __Pyx_XDECREF(__pyx_r);
9651 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->convert_item_to_object(__pyx_v_self, __pyx_v_itemp);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 416, __pyx_L1_error)
9652 __Pyx_GOTREF(__pyx_t_3);
9653 __pyx_r = __pyx_t_3;
9668 __Pyx_XDECREF(__pyx_t_3);
9669 __Pyx_XDECREF(__pyx_t_4);
9670 __Pyx_XDECREF(__pyx_t_5);
9671 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9674 __Pyx_XDECREF(__pyx_v_have_slices);
9675 __Pyx_XDECREF(__pyx_v_indices);
9676 __Pyx_XGIVEREF(__pyx_r);
9677 __Pyx_TraceReturn(__pyx_r, 0);
9678 __Pyx_RefNannyFinishContext();
9691 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value);
9692 static int __pyx_memoryview___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9694 __Pyx_RefNannyDeclarations
9695 __Pyx_RefNannySetupContext(
"__setitem__ (wrapper)", 0);
9696 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v_index), ((PyObject *)__pyx_v_value));
9699 __Pyx_RefNannyFinishContext();
9703 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setitem__(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
9704 PyObject *__pyx_v_have_slices = NULL;
9705 PyObject *__pyx_v_obj = NULL;
9707 __Pyx_TraceDeclarations
9708 __Pyx_RefNannyDeclarations
9710 PyObject *__pyx_t_2 = NULL;
9711 PyObject *__pyx_t_3 = NULL;
9712 PyObject *__pyx_t_4 = NULL;
9713 int __pyx_lineno = 0;
9714 const char *__pyx_filename = NULL;
9715 int __pyx_clineno = 0;
9716 __Pyx_RefNannySetupContext(
"__setitem__", 0);
9717 __Pyx_TraceCall(
"__setitem__", __pyx_f[2], 418, 0, __PYX_ERR(2, 418, __pyx_L1_error));
9718 __Pyx_INCREF(__pyx_v_index);
9727 __Pyx_TraceLine(419,0,__PYX_ERR(2, 419, __pyx_L1_error))
9728 __pyx_t_1 = (__pyx_v_self->view.readonly != 0);
9729 if (unlikely(__pyx_t_1)) {
9738 __Pyx_TraceLine(420,0,__PYX_ERR(2, 420, __pyx_L1_error))
9739 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 420, __pyx_L1_error)
9740 __Pyx_GOTREF(__pyx_t_2);
9741 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
9742 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9743 __PYX_ERR(2, 420, __pyx_L1_error)
9761 __Pyx_TraceLine(422,0,__PYX_ERR(2, 422, __pyx_L1_error))
9762 __pyx_t_2 = _unellipsify(__pyx_v_index, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 422, __pyx_L1_error)
9763 __Pyx_GOTREF(__pyx_t_2);
9764 if (likely(__pyx_t_2 != Py_None)) {
9765 PyObject* sequence = __pyx_t_2;
9766 Py_ssize_t size = __Pyx_PySequence_SIZE(sequence);
9767 if (unlikely(size != 2)) {
9768 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9769 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9770 __PYX_ERR(2, 422, __pyx_L1_error)
9772 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9773 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9774 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9775 __Pyx_INCREF(__pyx_t_3);
9776 __Pyx_INCREF(__pyx_t_4);
9778 __pyx_t_3 = PySequence_ITEM(sequence, 0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 422, __pyx_L1_error)
9779 __Pyx_GOTREF(__pyx_t_3);
9780 __pyx_t_4 = PySequence_ITEM(sequence, 1);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 422, __pyx_L1_error)
9781 __Pyx_GOTREF(__pyx_t_4);
9783 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9785 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(2, 422, __pyx_L1_error)
9787 __pyx_v_have_slices = __pyx_t_3;
9789 __Pyx_DECREF_SET(__pyx_v_index, __pyx_t_4);
9799 __Pyx_TraceLine(424,0,__PYX_ERR(2, 424, __pyx_L1_error))
9800 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_have_slices);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 424, __pyx_L1_error)
9810 __Pyx_TraceLine(425,0,__PYX_ERR(2, 425, __pyx_L1_error))
9811 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->is_slice(__pyx_v_self, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 425, __pyx_L1_error)
9812 __Pyx_GOTREF(__pyx_t_2);
9813 __pyx_v_obj = __pyx_t_2;
9823 __Pyx_TraceLine(426,0,__PYX_ERR(2, 426, __pyx_L1_error))
9824 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_obj);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 426, __pyx_L1_error)
9834 __Pyx_TraceLine(427,0,__PYX_ERR(2, 427, __pyx_L1_error))
9835 __pyx_t_2 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 427, __pyx_L1_error)
9836 __Pyx_GOTREF(__pyx_t_2);
9837 __pyx_t_4 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assignment(__pyx_v_self, __pyx_t_2, __pyx_v_obj);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 427, __pyx_L1_error)
9838 __Pyx_GOTREF(__pyx_t_4);
9839 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9840 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9859 __Pyx_TraceLine(429,0,__PYX_ERR(2, 429, __pyx_L1_error))
9861 __pyx_t_4 = __Pyx_PyObject_GetItem(((PyObject *)__pyx_v_self), __pyx_v_index);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 429, __pyx_L1_error)
9862 __Pyx_GOTREF(__pyx_t_4);
9863 if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_memoryview_type))))) __PYX_ERR(2, 429, __pyx_L1_error)
9864 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_slice_assign_scalar(__pyx_v_self, ((
struct __pyx_memoryview_obj *)__pyx_t_4), __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 429, __pyx_L1_error)
9865 __Pyx_GOTREF(__pyx_t_2);
9866 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9867 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9888 __Pyx_TraceLine(431,0,__PYX_ERR(2, 431, __pyx_L1_error))
9890 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->setitem_indexed(__pyx_v_self, __pyx_v_index, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 431, __pyx_L1_error)
9891 __Pyx_GOTREF(__pyx_t_2);
9892 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
9908 __Pyx_XDECREF(__pyx_t_2);
9909 __Pyx_XDECREF(__pyx_t_3);
9910 __Pyx_XDECREF(__pyx_t_4);
9911 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setitem__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9914 __Pyx_XDECREF(__pyx_v_have_slices);
9915 __Pyx_XDECREF(__pyx_v_obj);
9916 __Pyx_XDECREF(__pyx_v_index);
9917 __Pyx_TraceReturn(Py_None, 0);
9918 __Pyx_RefNannyFinishContext();
9930 static PyObject *__pyx_memoryview_is_slice(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_obj) {
9931 PyObject *__pyx_r = NULL;
9932 __Pyx_TraceDeclarations
9933 __Pyx_RefNannyDeclarations
9936 PyObject *__pyx_t_3 = NULL;
9937 PyObject *__pyx_t_4 = NULL;
9938 PyObject *__pyx_t_5 = NULL;
9939 PyObject *__pyx_t_6 = NULL;
9940 PyObject *__pyx_t_7 = NULL;
9941 PyObject *__pyx_t_8 = NULL;
9943 int __pyx_lineno = 0;
9944 const char *__pyx_filename = NULL;
9945 int __pyx_clineno = 0;
9946 __Pyx_RefNannySetupContext(
"is_slice", 0);
9947 __Pyx_TraceCall(
"is_slice", __pyx_f[2], 433, 0, __PYX_ERR(2, 433, __pyx_L1_error));
9948 __Pyx_INCREF(__pyx_v_obj);
9957 __Pyx_TraceLine(434,0,__PYX_ERR(2, 434, __pyx_L1_error))
9958 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_obj, __pyx_memoryview_type);
9959 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
9969 __Pyx_TraceLine(435,0,__PYX_ERR(2, 435, __pyx_L1_error))
9971 __Pyx_PyThreadState_declare
9972 __Pyx_PyThreadState_assign
9973 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
9974 __Pyx_XGOTREF(__pyx_t_3);
9975 __Pyx_XGOTREF(__pyx_t_4);
9976 __Pyx_XGOTREF(__pyx_t_5);
9986 __Pyx_TraceLine(436,0,__PYX_ERR(2, 436, __pyx_L4_error))
9987 __pyx_t_6 = __Pyx_PyInt_From_int(((__pyx_v_self->flags & (~PyBUF_WRITABLE)) | PyBUF_ANY_CONTIGUOUS));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 436, __pyx_L4_error)
9988 __Pyx_GOTREF(__pyx_t_6);
9997 __Pyx_TraceLine(437,0,__PYX_ERR(2, 437, __pyx_L4_error))
9998 __pyx_t_7 = __Pyx_PyBool_FromLong(__pyx_v_self->dtype_is_object);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 437, __pyx_L4_error)
9999 __Pyx_GOTREF(__pyx_t_7);
10008 __Pyx_TraceLine(436,0,__PYX_ERR(2, 436, __pyx_L4_error))
10009 __pyx_t_8 = PyTuple_New(3);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 436, __pyx_L4_error)
10010 __Pyx_GOTREF(__pyx_t_8);
10011 __Pyx_INCREF(__pyx_v_obj);
10012 __Pyx_GIVEREF(__pyx_v_obj);
10013 PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_obj);
10014 __Pyx_GIVEREF(__pyx_t_6);
10015 PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_6);
10016 __Pyx_GIVEREF(__pyx_t_7);
10017 PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_7);
10020 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_8, NULL);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 436, __pyx_L4_error)
10021 __Pyx_GOTREF(__pyx_t_7);
10022 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10023 __Pyx_DECREF_SET(__pyx_v_obj, __pyx_t_7);
10034 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10035 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
10036 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10037 goto __pyx_L9_try_end;
10039 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10040 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10041 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
10050 __Pyx_TraceLine(438,0,__PYX_ERR(2, 438, __pyx_L6_except_error))
10051 __pyx_t_9 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_TypeError);
10053 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10054 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_6) < 0) __PYX_ERR(2, 438, __pyx_L6_except_error)
10055 __Pyx_GOTREF(__pyx_t_7);
10056 __Pyx_GOTREF(__pyx_t_8);
10057 __Pyx_GOTREF(__pyx_t_6);
10066 __Pyx_TraceLine(439,0,__PYX_ERR(2, 439, __pyx_L6_except_error))
10067 __Pyx_XDECREF(__pyx_r);
10068 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10069 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10070 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
10071 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10072 goto __pyx_L7_except_return;
10074 goto __pyx_L6_except_error;
10075 __pyx_L6_except_error:;
10084 __Pyx_XGIVEREF(__pyx_t_3);
10085 __Pyx_XGIVEREF(__pyx_t_4);
10086 __Pyx_XGIVEREF(__pyx_t_5);
10087 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10088 goto __pyx_L1_error;
10089 __pyx_L7_except_return:;
10090 __Pyx_XGIVEREF(__pyx_t_3);
10091 __Pyx_XGIVEREF(__pyx_t_4);
10092 __Pyx_XGIVEREF(__pyx_t_5);
10093 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
10114 __Pyx_TraceLine(441,0,__PYX_ERR(2, 441, __pyx_L1_error))
10115 __Pyx_XDECREF(__pyx_r);
10116 __Pyx_INCREF(__pyx_v_obj);
10117 __pyx_r = __pyx_v_obj;
10130 __Pyx_XDECREF(__pyx_t_6);
10131 __Pyx_XDECREF(__pyx_t_7);
10132 __Pyx_XDECREF(__pyx_t_8);
10133 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
10136 __Pyx_XDECREF(__pyx_v_obj);
10137 __Pyx_XGIVEREF(__pyx_r);
10138 __Pyx_TraceReturn(__pyx_r, 0);
10139 __Pyx_RefNannyFinishContext();
10151 static PyObject *__pyx_memoryview_setitem_slice_assignment(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_dst, PyObject *__pyx_v_src) {
10152 __Pyx_memviewslice __pyx_v_dst_slice;
10153 __Pyx_memviewslice __pyx_v_src_slice;
10154 PyObject *__pyx_r = NULL;
10155 __Pyx_TraceDeclarations
10156 __Pyx_RefNannyDeclarations
10157 __Pyx_memviewslice *__pyx_t_1;
10158 __Pyx_memviewslice *__pyx_t_2;
10159 PyObject *__pyx_t_3 = NULL;
10163 int __pyx_lineno = 0;
10164 const char *__pyx_filename = NULL;
10165 int __pyx_clineno = 0;
10166 __Pyx_RefNannySetupContext(
"setitem_slice_assignment", 0);
10167 __Pyx_TraceCall(
"setitem_slice_assignment", __pyx_f[2], 443, 0, __PYX_ERR(2, 443, __pyx_L1_error));
10176 __Pyx_TraceLine(447,0,__PYX_ERR(2, 447, __pyx_L1_error))
10177 if (!(likely(((__pyx_v_src) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_src, __pyx_memoryview_type))))) __PYX_ERR(2, 447, __pyx_L1_error)
10178 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_src), (&__pyx_v_src_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 447, __pyx_L1_error)
10187 __Pyx_TraceLine(448,0,__PYX_ERR(2, 448, __pyx_L1_error))
10188 if (!(likely(((__pyx_v_dst) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_dst, __pyx_memoryview_type))))) __PYX_ERR(2, 448, __pyx_L1_error)
10189 __pyx_t_2 = __pyx_memoryview_get_slice_from_memoryview(((
struct __pyx_memoryview_obj *)__pyx_v_dst), (&__pyx_v_dst_slice));
if (unlikely(__pyx_t_2 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 448, __pyx_L1_error)
10198 __Pyx_TraceLine(449,0,__PYX_ERR(2, 449, __pyx_L1_error))
10199 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_src, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
10200 __Pyx_GOTREF(__pyx_t_3);
10201 __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_4 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
10202 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10203 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_dst, __pyx_n_s_ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 449, __pyx_L1_error)
10204 __Pyx_GOTREF(__pyx_t_3);
10205 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3);
if (unlikely((__pyx_t_5 == (
int)-1) && PyErr_Occurred())) __PYX_ERR(2, 449, __pyx_L1_error)
10206 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10215 __Pyx_TraceLine(447,0,__PYX_ERR(2, 447, __pyx_L1_error))
10216 __pyx_t_6 = __pyx_memoryview_copy_contents((__pyx_t_1[0]), (__pyx_t_2[0]), __pyx_t_4, __pyx_t_5, __pyx_v_self->dtype_is_object);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 447, __pyx_L1_error)
10227 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10230 __Pyx_XDECREF(__pyx_t_3);
10231 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assignment", __pyx_clineno, __pyx_lineno, __pyx_filename);
10234 __Pyx_XGIVEREF(__pyx_r);
10235 __Pyx_TraceReturn(__pyx_r, 0);
10236 __Pyx_RefNannyFinishContext();
10248 static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(
struct __pyx_memoryview_obj *__pyx_v_self,
struct __pyx_memoryview_obj *__pyx_v_dst, PyObject *__pyx_v_value) {
10249 int __pyx_v_array[0x80];
10251 void *__pyx_v_item;
10252 __Pyx_memviewslice *__pyx_v_dst_slice;
10253 __Pyx_memviewslice __pyx_v_tmp_slice;
10254 PyObject *__pyx_r = NULL;
10255 __Pyx_TraceDeclarations
10256 __Pyx_RefNannyDeclarations
10257 __Pyx_memviewslice *__pyx_t_1;
10259 PyObject *__pyx_t_3 = NULL;
10262 char const *__pyx_t_6;
10263 PyObject *__pyx_t_7 = NULL;
10264 PyObject *__pyx_t_8 = NULL;
10265 PyObject *__pyx_t_9 = NULL;
10266 PyObject *__pyx_t_10 = NULL;
10267 PyObject *__pyx_t_11 = NULL;
10268 PyObject *__pyx_t_12 = NULL;
10269 int __pyx_lineno = 0;
10270 const char *__pyx_filename = NULL;
10271 int __pyx_clineno = 0;
10272 __Pyx_RefNannySetupContext(
"setitem_slice_assign_scalar", 0);
10273 __Pyx_TraceCall(
"setitem_slice_assign_scalar", __pyx_f[2], 451, 0, __PYX_ERR(2, 451, __pyx_L1_error));
10282 __Pyx_TraceLine(453,0,__PYX_ERR(2, 453, __pyx_L1_error))
10283 __pyx_v_tmp = NULL;
10292 __Pyx_TraceLine(458,0,__PYX_ERR(2, 458, __pyx_L1_error))
10293 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_dst, (&__pyx_v_tmp_slice));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 458, __pyx_L1_error)
10294 __pyx_v_dst_slice = __pyx_t_1;
10303 __Pyx_TraceLine(460,0,__PYX_ERR(2, 460, __pyx_L1_error))
10304 __pyx_t_2 = ((((size_t)__pyx_v_self->view.itemsize) > (
sizeof(__pyx_v_array))) != 0);
10314 __Pyx_TraceLine(461,0,__PYX_ERR(2, 461, __pyx_L1_error))
10315 __pyx_v_tmp = PyMem_Malloc(__pyx_v_self->view.itemsize);
10324 __Pyx_TraceLine(462,0,__PYX_ERR(2, 462, __pyx_L1_error))
10325 __pyx_t_2 = ((__pyx_v_tmp == NULL) != 0);
10326 if (unlikely(__pyx_t_2)) {
10335 __Pyx_TraceLine(463,0,__PYX_ERR(2, 463, __pyx_L1_error))
10336 PyErr_NoMemory(); __PYX_ERR(2, 463, __pyx_L1_error)
10354 __Pyx_TraceLine(464,0,__PYX_ERR(2, 464, __pyx_L1_error))
10355 __pyx_v_item = __pyx_v_tmp;
10374 __Pyx_TraceLine(466,0,__PYX_ERR(2, 466, __pyx_L1_error))
10376 __pyx_v_item = ((
void *)__pyx_v_array);
10387 __Pyx_TraceLine(468,0,__PYX_ERR(2, 468, __pyx_L1_error))
10397 __Pyx_TraceLine(469,0,__PYX_ERR(2, 469, __pyx_L6_error))
10398 __pyx_t_2 = (__pyx_v_self->dtype_is_object != 0);
10408 __Pyx_TraceLine(470,0,__PYX_ERR(2, 470, __pyx_L6_error))
10409 (((PyObject **)__pyx_v_item)[0]) = ((PyObject *)__pyx_v_value);
10428 __Pyx_TraceLine(472,0,__PYX_ERR(2, 472, __pyx_L6_error))
10430 __pyx_t_3 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, ((
char *)__pyx_v_item), __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 472, __pyx_L6_error)
10431 __Pyx_GOTREF(__pyx_t_3);
10432 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10443 __Pyx_TraceLine(476,0,__PYX_ERR(2, 476, __pyx_L6_error))
10444 __pyx_t_2 = ((__pyx_v_self->view.suboffsets != NULL) != 0);
10454 __Pyx_TraceLine(477,0,__PYX_ERR(2, 477, __pyx_L6_error))
10455 __pyx_t_3 = assert_direct_dimensions(__pyx_v_self->view.suboffsets, __pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 477, __pyx_L6_error)
10456 __Pyx_GOTREF(__pyx_t_3);
10457 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10475 __Pyx_TraceLine(478,0,__PYX_ERR(2, 478, __pyx_L6_error))
10476 __pyx_memoryview_slice_assign_scalar(__pyx_v_dst_slice, __pyx_v_dst->view.ndim, __pyx_v_self->view.itemsize, __pyx_v_item, __pyx_v_self->dtype_is_object);
10486 __Pyx_TraceLine(481,0,__PYX_ERR(2, 481, __pyx_L6_error))
10489 PyMem_Free(__pyx_v_tmp);
10494 __Pyx_PyThreadState_declare
10495 __Pyx_PyThreadState_assign
10496 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10497 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10498 if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
10499 if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
10500 __Pyx_XGOTREF(__pyx_t_7);
10501 __Pyx_XGOTREF(__pyx_t_8);
10502 __Pyx_XGOTREF(__pyx_t_9);
10503 __Pyx_XGOTREF(__pyx_t_10);
10504 __Pyx_XGOTREF(__pyx_t_11);
10505 __Pyx_XGOTREF(__pyx_t_12);
10506 __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
10508 PyMem_Free(__pyx_v_tmp);
10510 if (PY_MAJOR_VERSION >= 3) {
10511 __Pyx_XGIVEREF(__pyx_t_10);
10512 __Pyx_XGIVEREF(__pyx_t_11);
10513 __Pyx_XGIVEREF(__pyx_t_12);
10514 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
10516 __Pyx_XGIVEREF(__pyx_t_7);
10517 __Pyx_XGIVEREF(__pyx_t_8);
10518 __Pyx_XGIVEREF(__pyx_t_9);
10519 __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
10520 __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
10521 __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
10522 goto __pyx_L1_error;
10536 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10539 __Pyx_XDECREF(__pyx_t_3);
10540 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename);
10543 __Pyx_XGIVEREF(__pyx_r);
10544 __Pyx_TraceReturn(__pyx_r, 0);
10545 __Pyx_RefNannyFinishContext();
10557 static PyObject *__pyx_memoryview_setitem_indexed(
struct __pyx_memoryview_obj *__pyx_v_self, PyObject *__pyx_v_index, PyObject *__pyx_v_value) {
10558 char *__pyx_v_itemp;
10559 PyObject *__pyx_r = NULL;
10560 __Pyx_TraceDeclarations
10561 __Pyx_RefNannyDeclarations
10563 PyObject *__pyx_t_2 = NULL;
10564 int __pyx_lineno = 0;
10565 const char *__pyx_filename = NULL;
10566 int __pyx_clineno = 0;
10567 __Pyx_RefNannySetupContext(
"setitem_indexed", 0);
10568 __Pyx_TraceCall(
"setitem_indexed", __pyx_f[2], 483, 0, __PYX_ERR(2, 483, __pyx_L1_error));
10577 __Pyx_TraceLine(484,0,__PYX_ERR(2, 484, __pyx_L1_error))
10578 __pyx_t_1 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->get_item_pointer(__pyx_v_self, __pyx_v_index);
if (unlikely(__pyx_t_1 == ((
char *)NULL))) __PYX_ERR(2, 484, __pyx_L1_error)
10579 __pyx_v_itemp = __pyx_t_1;
10588 __Pyx_TraceLine(485,0,__PYX_ERR(2, 485, __pyx_L1_error))
10589 __pyx_t_2 = ((
struct __pyx_vtabstruct_memoryview *)__pyx_v_self->__pyx_vtab)->assign_item_from_object(__pyx_v_self, __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 485, __pyx_L1_error)
10590 __Pyx_GOTREF(__pyx_t_2);
10591 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
10602 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
10605 __Pyx_XDECREF(__pyx_t_2);
10606 __Pyx_AddTraceback(
"View.MemoryView.memoryview.setitem_indexed", __pyx_clineno, __pyx_lineno, __pyx_filename);
10609 __Pyx_XGIVEREF(__pyx_r);
10610 __Pyx_TraceReturn(__pyx_r, 0);
10611 __Pyx_RefNannyFinishContext();
10623 static PyObject *__pyx_memoryview_convert_item_to_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp) {
10624 PyObject *__pyx_v_struct = NULL;
10625 PyObject *__pyx_v_bytesitem = 0;
10626 PyObject *__pyx_v_result = NULL;
10627 PyObject *__pyx_r = NULL;
10628 __Pyx_TraceDeclarations
10629 __Pyx_RefNannyDeclarations
10630 PyObject *__pyx_t_1 = NULL;
10631 PyObject *__pyx_t_2 = NULL;
10632 PyObject *__pyx_t_3 = NULL;
10633 PyObject *__pyx_t_4 = NULL;
10634 PyObject *__pyx_t_5 = NULL;
10635 PyObject *__pyx_t_6 = NULL;
10636 PyObject *__pyx_t_7 = NULL;
10638 PyObject *__pyx_t_9 = NULL;
10641 int __pyx_lineno = 0;
10642 const char *__pyx_filename = NULL;
10643 int __pyx_clineno = 0;
10644 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
10645 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[2], 487, 0, __PYX_ERR(2, 487, __pyx_L1_error));
10654 __Pyx_TraceLine(490,0,__PYX_ERR(2, 490, __pyx_L1_error))
10655 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 490, __pyx_L1_error)
10656 __Pyx_GOTREF(__pyx_t_1);
10657 __pyx_v_struct = __pyx_t_1;
10667 __Pyx_TraceLine(493,0,__PYX_ERR(2, 493, __pyx_L1_error))
10668 __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_itemp + 0, __pyx_v_self->view.itemsize - 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 493, __pyx_L1_error)
10669 __Pyx_GOTREF(__pyx_t_1);
10670 __pyx_v_bytesitem = ((PyObject*)__pyx_t_1);
10680 __Pyx_TraceLine(494,0,__PYX_ERR(2, 494, __pyx_L1_error))
10682 __Pyx_PyThreadState_declare
10683 __Pyx_PyThreadState_assign
10684 __Pyx_ExceptionSave(&__pyx_t_2, &__pyx_t_3, &__pyx_t_4);
10685 __Pyx_XGOTREF(__pyx_t_2);
10686 __Pyx_XGOTREF(__pyx_t_3);
10687 __Pyx_XGOTREF(__pyx_t_4);
10697 __Pyx_TraceLine(495,0,__PYX_ERR(2, 495, __pyx_L3_error))
10698 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_unpack);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 495, __pyx_L3_error)
10699 __Pyx_GOTREF(__pyx_t_5);
10700 __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 495, __pyx_L3_error)
10701 __Pyx_GOTREF(__pyx_t_6);
10704 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) {
10705 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
10706 if (likely(__pyx_t_7)) {
10707 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_5);
10708 __Pyx_INCREF(__pyx_t_7);
10709 __Pyx_INCREF(
function);
10710 __Pyx_DECREF_SET(__pyx_t_5,
function);
10714 #if CYTHON_FAST_PYCALL
10715 if (PyFunction_Check(__pyx_t_5)) {
10716 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10717 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10718 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10719 __Pyx_GOTREF(__pyx_t_1);
10720 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10723 #if CYTHON_FAST_PYCCALL
10724 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
10725 PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_bytesitem};
10726 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10727 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10728 __Pyx_GOTREF(__pyx_t_1);
10729 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10733 __pyx_t_9 = PyTuple_New(2+__pyx_t_8);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 495, __pyx_L3_error)
10734 __Pyx_GOTREF(__pyx_t_9);
10736 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
10738 __Pyx_GIVEREF(__pyx_t_6);
10739 PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6);
10740 __Pyx_INCREF(__pyx_v_bytesitem);
10741 __Pyx_GIVEREF(__pyx_v_bytesitem);
10742 PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_bytesitem);
10744 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 495, __pyx_L3_error)
10745 __Pyx_GOTREF(__pyx_t_1);
10746 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
10748 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10749 __pyx_v_result = __pyx_t_1;
10768 __Pyx_TraceLine(499,0,__PYX_ERR(2, 499, __pyx_L5_except_error))
10770 __pyx_t_10 = strlen(__pyx_v_self->view.format);
10771 __pyx_t_11 = ((__pyx_t_10 == 1) != 0);
10781 __Pyx_TraceLine(500,0,__PYX_ERR(2, 500, __pyx_L5_except_error))
10782 __Pyx_XDECREF(__pyx_r);
10783 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_result, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 500, __pyx_L5_except_error)
10784 __Pyx_GOTREF(__pyx_t_1);
10785 __pyx_r = __pyx_t_1;
10787 goto __pyx_L6_except_return;
10805 __Pyx_TraceLine(501,0,__PYX_ERR(2, 501, __pyx_L5_except_error))
10806 __Pyx_XDECREF(__pyx_r);
10807 __Pyx_INCREF(__pyx_v_result);
10808 __pyx_r = __pyx_v_result;
10809 goto __pyx_L6_except_return;
10812 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10813 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
10814 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
10815 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
10816 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
10825 __Pyx_TraceLine(496,0,__PYX_ERR(2, 496, __pyx_L5_except_error))
10826 __Pyx_ErrFetch(&__pyx_t_1, &__pyx_t_5, &__pyx_t_9);
10827 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_error);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 496, __pyx_L5_except_error)
10828 __Pyx_GOTREF(__pyx_t_6);
10829 __pyx_t_8 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_1, __pyx_t_6);
10830 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10831 __Pyx_ErrRestore(__pyx_t_1, __pyx_t_5, __pyx_t_9);
10832 __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_9 = 0;
10834 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10835 if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_5, &__pyx_t_1) < 0) __PYX_ERR(2, 496, __pyx_L5_except_error)
10836 __Pyx_GOTREF(__pyx_t_9);
10837 __Pyx_GOTREF(__pyx_t_5);
10838 __Pyx_GOTREF(__pyx_t_1);
10847 __Pyx_TraceLine(497,0,__PYX_ERR(2, 497, __pyx_L5_except_error))
10848 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 497, __pyx_L5_except_error)
10849 __Pyx_GOTREF(__pyx_t_6);
10850 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
10851 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10852 __PYX_ERR(2, 497, __pyx_L5_except_error)
10854 goto __pyx_L5_except_error;
10855 __pyx_L5_except_error:;
10864 __Pyx_XGIVEREF(__pyx_t_2);
10865 __Pyx_XGIVEREF(__pyx_t_3);
10866 __Pyx_XGIVEREF(__pyx_t_4);
10867 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10868 goto __pyx_L1_error;
10869 __pyx_L6_except_return:;
10870 __Pyx_XGIVEREF(__pyx_t_2);
10871 __Pyx_XGIVEREF(__pyx_t_3);
10872 __Pyx_XGIVEREF(__pyx_t_4);
10873 __Pyx_ExceptionReset(__pyx_t_2, __pyx_t_3, __pyx_t_4);
10887 __Pyx_XDECREF(__pyx_t_1);
10888 __Pyx_XDECREF(__pyx_t_5);
10889 __Pyx_XDECREF(__pyx_t_6);
10890 __Pyx_XDECREF(__pyx_t_7);
10891 __Pyx_XDECREF(__pyx_t_9);
10892 __Pyx_AddTraceback(
"View.MemoryView.memoryview.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
10895 __Pyx_XDECREF(__pyx_v_struct);
10896 __Pyx_XDECREF(__pyx_v_bytesitem);
10897 __Pyx_XDECREF(__pyx_v_result);
10898 __Pyx_XGIVEREF(__pyx_r);
10899 __Pyx_TraceReturn(__pyx_r, 0);
10900 __Pyx_RefNannyFinishContext();
10912 static PyObject *__pyx_memoryview_assign_item_from_object(
struct __pyx_memoryview_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
10913 PyObject *__pyx_v_struct = NULL;
10915 PyObject *__pyx_v_bytesvalue = 0;
10916 Py_ssize_t __pyx_v_i;
10917 PyObject *__pyx_r = NULL;
10918 __Pyx_TraceDeclarations
10919 __Pyx_RefNannyDeclarations
10920 PyObject *__pyx_t_1 = NULL;
10923 PyObject *__pyx_t_4 = NULL;
10924 PyObject *__pyx_t_5 = NULL;
10925 PyObject *__pyx_t_6 = NULL;
10927 PyObject *__pyx_t_8 = NULL;
10928 Py_ssize_t __pyx_t_9;
10929 PyObject *__pyx_t_10 = NULL;
10934 int __pyx_lineno = 0;
10935 const char *__pyx_filename = NULL;
10936 int __pyx_clineno = 0;
10937 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
10938 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[2], 503, 0, __PYX_ERR(2, 503, __pyx_L1_error));
10947 __Pyx_TraceLine(506,0,__PYX_ERR(2, 506, __pyx_L1_error))
10948 __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 506, __pyx_L1_error)
10949 __Pyx_GOTREF(__pyx_t_1);
10950 __pyx_v_struct = __pyx_t_1;
10960 __Pyx_TraceLine(511,0,__PYX_ERR(2, 511, __pyx_L1_error))
10961 __pyx_t_2 = PyTuple_Check(__pyx_v_value);
10962 __pyx_t_3 = (__pyx_t_2 != 0);
10972 __Pyx_TraceLine(512,0,__PYX_ERR(2, 512, __pyx_L1_error))
10973 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 512, __pyx_L1_error)
10974 __Pyx_GOTREF(__pyx_t_1);
10975 __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10976 __Pyx_GOTREF(__pyx_t_4);
10977 __pyx_t_5 = PyTuple_New(1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 512, __pyx_L1_error)
10978 __Pyx_GOTREF(__pyx_t_5);
10979 __Pyx_GIVEREF(__pyx_t_4);
10980 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
10982 __pyx_t_4 = __Pyx_PySequence_Tuple(__pyx_v_value);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10983 __Pyx_GOTREF(__pyx_t_4);
10984 __pyx_t_6 = PyNumber_Add(__pyx_t_5, __pyx_t_4);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 512, __pyx_L1_error)
10985 __Pyx_GOTREF(__pyx_t_6);
10986 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
10987 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10988 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 512, __pyx_L1_error)
10989 __Pyx_GOTREF(__pyx_t_4);
10990 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10991 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
10992 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 512, __pyx_L1_error)
10993 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11013 __Pyx_TraceLine(514,0,__PYX_ERR(2, 514, __pyx_L1_error))
11015 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_struct, __pyx_n_s_pack);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 514, __pyx_L1_error)
11016 __Pyx_GOTREF(__pyx_t_6);
11017 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->view.format);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 514, __pyx_L1_error)
11018 __Pyx_GOTREF(__pyx_t_1);
11021 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
11022 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
11023 if (likely(__pyx_t_5)) {
11024 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_6);
11025 __Pyx_INCREF(__pyx_t_5);
11026 __Pyx_INCREF(
function);
11027 __Pyx_DECREF_SET(__pyx_t_6,
function);
11031 #if CYTHON_FAST_PYCALL
11032 if (PyFunction_Check(__pyx_t_6)) {
11033 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11034 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
11035 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11036 __Pyx_GOTREF(__pyx_t_4);
11037 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11040 #if CYTHON_FAST_PYCCALL
11041 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
11042 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_1, __pyx_v_value};
11043 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
11044 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
11045 __Pyx_GOTREF(__pyx_t_4);
11046 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11050 __pyx_t_8 = PyTuple_New(2+__pyx_t_7);
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 514, __pyx_L1_error)
11051 __Pyx_GOTREF(__pyx_t_8);
11053 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __pyx_t_5 = NULL;
11055 __Pyx_GIVEREF(__pyx_t_1);
11056 PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_1);
11057 __Pyx_INCREF(__pyx_v_value);
11058 __Pyx_GIVEREF(__pyx_v_value);
11059 PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_value);
11061 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 514, __pyx_L1_error)
11062 __Pyx_GOTREF(__pyx_t_4);
11063 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
11065 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11066 if (!(likely(PyBytes_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"bytes", Py_TYPE(__pyx_t_4)->tp_name), 0))) __PYX_ERR(2, 514, __pyx_L1_error)
11067 __pyx_v_bytesvalue = ((PyObject*)__pyx_t_4);
11079 __Pyx_TraceLine(516,0,__PYX_ERR(2, 516, __pyx_L1_error))
11081 if (unlikely(__pyx_v_bytesvalue == Py_None)) {
11082 PyErr_SetString(PyExc_TypeError,
"'NoneType' is not iterable");
11083 __PYX_ERR(2, 516, __pyx_L1_error)
11085 __Pyx_INCREF(__pyx_v_bytesvalue);
11086 __pyx_t_10 = __pyx_v_bytesvalue;
11087 __pyx_t_12 = PyBytes_AS_STRING(__pyx_t_10);
11088 __pyx_t_13 = (__pyx_t_12 + PyBytes_GET_SIZE(__pyx_t_10));
11089 for (__pyx_t_14 = __pyx_t_12; __pyx_t_14 < __pyx_t_13; __pyx_t_14++) {
11090 __pyx_t_11 = __pyx_t_14;
11091 __pyx_v_c = (__pyx_t_11[0]);
11100 __Pyx_TraceLine(517,0,__PYX_ERR(2, 517, __pyx_L1_error))
11101 __pyx_v_i = __pyx_t_9;
11110 __Pyx_TraceLine(516,0,__PYX_ERR(2, 516, __pyx_L1_error))
11111 __pyx_t_9 = (__pyx_t_9 + 1);
11120 __Pyx_TraceLine(517,0,__PYX_ERR(2, 517, __pyx_L1_error))
11121 (__pyx_v_itemp[__pyx_v_i]) = __pyx_v_c;
11123 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
11134 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
11137 __Pyx_XDECREF(__pyx_t_1);
11138 __Pyx_XDECREF(__pyx_t_4);
11139 __Pyx_XDECREF(__pyx_t_5);
11140 __Pyx_XDECREF(__pyx_t_6);
11141 __Pyx_XDECREF(__pyx_t_8);
11142 __Pyx_XDECREF(__pyx_t_10);
11143 __Pyx_AddTraceback(
"View.MemoryView.memoryview.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
11146 __Pyx_XDECREF(__pyx_v_struct);
11147 __Pyx_XDECREF(__pyx_v_bytesvalue);
11148 __Pyx_XGIVEREF(__pyx_r);
11149 __Pyx_TraceReturn(__pyx_r, 0);
11150 __Pyx_RefNannyFinishContext();
11163 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags);
11164 static CYTHON_UNUSED
int __pyx_memoryview_getbuffer(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11166 __Pyx_RefNannyDeclarations
11167 __Pyx_RefNannySetupContext(
"__getbuffer__ (wrapper)", 0);
11168 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((
int)__pyx_v_flags));
11171 __Pyx_RefNannyFinishContext();
11175 static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbuffer__(
struct __pyx_memoryview_obj *__pyx_v_self, Py_buffer *__pyx_v_info,
int __pyx_v_flags) {
11177 __Pyx_TraceDeclarations
11178 __Pyx_RefNannyDeclarations
11181 PyObject *__pyx_t_3 = NULL;
11182 Py_ssize_t *__pyx_t_4;
11186 Py_ssize_t __pyx_t_8;
11187 int __pyx_lineno = 0;
11188 const char *__pyx_filename = NULL;
11189 int __pyx_clineno = 0;
11190 if (__pyx_v_info == NULL) {
11191 PyErr_SetString(PyExc_BufferError,
"PyObject_GetBuffer: view==NULL argument is obsolete");
11194 __Pyx_RefNannySetupContext(
"__getbuffer__", 0);
11195 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
11196 __Pyx_GIVEREF(__pyx_v_info->obj);
11197 __Pyx_TraceCall(
"__getbuffer__", __pyx_f[2], 520, 0, __PYX_ERR(2, 520, __pyx_L1_error));
11206 __Pyx_TraceLine(521,0,__PYX_ERR(2, 521, __pyx_L1_error))
11207 __pyx_t_2 = ((__pyx_v_flags & PyBUF_WRITABLE) != 0);
11210 __pyx_t_1 = __pyx_t_2;
11211 goto __pyx_L4_bool_binop_done;
11213 __pyx_t_2 = (__pyx_v_self->view.readonly != 0);
11214 __pyx_t_1 = __pyx_t_2;
11215 __pyx_L4_bool_binop_done:;
11216 if (unlikely(__pyx_t_1)) {
11225 __Pyx_TraceLine(522,0,__PYX_ERR(2, 522, __pyx_L1_error))
11226 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 522, __pyx_L1_error)
11227 __Pyx_GOTREF(__pyx_t_3);
11228 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
11229 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11230 __PYX_ERR(2, 522, __pyx_L1_error)
11248 __Pyx_TraceLine(524,0,__PYX_ERR(2, 524, __pyx_L1_error))
11249 __pyx_t_1 = ((__pyx_v_flags & PyBUF_ND) != 0);
11259 __Pyx_TraceLine(525,0,__PYX_ERR(2, 525, __pyx_L1_error))
11260 __pyx_t_4 = __pyx_v_self->view.shape;
11261 __pyx_v_info->shape = __pyx_t_4;
11280 __Pyx_TraceLine(527,0,__PYX_ERR(2, 527, __pyx_L1_error))
11282 __pyx_v_info->shape = NULL;
11293 __Pyx_TraceLine(529,0,__PYX_ERR(2, 529, __pyx_L1_error))
11294 __pyx_t_1 = ((__pyx_v_flags & PyBUF_STRIDES) != 0);
11304 __Pyx_TraceLine(530,0,__PYX_ERR(2, 530, __pyx_L1_error))
11305 __pyx_t_4 = __pyx_v_self->view.strides;
11306 __pyx_v_info->strides = __pyx_t_4;
11325 __Pyx_TraceLine(532,0,__PYX_ERR(2, 532, __pyx_L1_error))
11327 __pyx_v_info->strides = NULL;
11338 __Pyx_TraceLine(534,0,__PYX_ERR(2, 534, __pyx_L1_error))
11339 __pyx_t_1 = ((__pyx_v_flags & PyBUF_INDIRECT) != 0);
11349 __Pyx_TraceLine(535,0,__PYX_ERR(2, 535, __pyx_L1_error))
11350 __pyx_t_4 = __pyx_v_self->view.suboffsets;
11351 __pyx_v_info->suboffsets = __pyx_t_4;
11370 __Pyx_TraceLine(537,0,__PYX_ERR(2, 537, __pyx_L1_error))
11372 __pyx_v_info->suboffsets = NULL;
11383 __Pyx_TraceLine(539,0,__PYX_ERR(2, 539, __pyx_L1_error))
11384 __pyx_t_1 = ((__pyx_v_flags & PyBUF_FORMAT) != 0);
11394 __Pyx_TraceLine(540,0,__PYX_ERR(2, 540, __pyx_L1_error))
11395 __pyx_t_5 = __pyx_v_self->view.format;
11396 __pyx_v_info->format = __pyx_t_5;
11415 __Pyx_TraceLine(542,0,__PYX_ERR(2, 542, __pyx_L1_error))
11417 __pyx_v_info->format = NULL;
11428 __Pyx_TraceLine(544,0,__PYX_ERR(2, 544, __pyx_L1_error))
11429 __pyx_t_6 = __pyx_v_self->view.buf;
11430 __pyx_v_info->buf = __pyx_t_6;
11439 __Pyx_TraceLine(545,0,__PYX_ERR(2, 545, __pyx_L1_error))
11440 __pyx_t_7 = __pyx_v_self->view.ndim;
11441 __pyx_v_info->ndim = __pyx_t_7;
11450 __Pyx_TraceLine(546,0,__PYX_ERR(2, 546, __pyx_L1_error))
11451 __pyx_t_8 = __pyx_v_self->view.itemsize;
11452 __pyx_v_info->itemsize = __pyx_t_8;
11461 __Pyx_TraceLine(547,0,__PYX_ERR(2, 547, __pyx_L1_error))
11462 __pyx_t_8 = __pyx_v_self->view.len;
11463 __pyx_v_info->len = __pyx_t_8;
11472 __Pyx_TraceLine(548,0,__PYX_ERR(2, 548, __pyx_L1_error))
11473 __pyx_t_1 = __pyx_v_self->view.readonly;
11474 __pyx_v_info->readonly = __pyx_t_1;
11483 __Pyx_TraceLine(549,0,__PYX_ERR(2, 549, __pyx_L1_error))
11484 __Pyx_INCREF(((PyObject *)__pyx_v_self));
11485 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
11486 __Pyx_GOTREF(__pyx_v_info->obj);
11487 __Pyx_DECREF(__pyx_v_info->obj);
11488 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
11502 __Pyx_XDECREF(__pyx_t_3);
11503 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11505 if (__pyx_v_info->obj != NULL) {
11506 __Pyx_GOTREF(__pyx_v_info->obj);
11507 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11511 if (__pyx_v_info->obj == Py_None) {
11512 __Pyx_GOTREF(__pyx_v_info->obj);
11513 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = 0;
11516 __Pyx_TraceReturn(Py_None, 0);
11517 __Pyx_RefNannyFinishContext();
11530 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self);
11531 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(PyObject *__pyx_v_self) {
11532 PyObject *__pyx_r = 0;
11533 __Pyx_RefNannyDeclarations
11534 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11535 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11538 __Pyx_RefNannyFinishContext();
11542 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11543 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
11544 PyObject *__pyx_r = NULL;
11545 __Pyx_TraceDeclarations
11546 __Pyx_RefNannyDeclarations
11547 PyObject *__pyx_t_1 = NULL;
11549 int __pyx_lineno = 0;
11550 const char *__pyx_filename = NULL;
11551 int __pyx_clineno = 0;
11552 __Pyx_RefNannySetupContext(
"__get__", 0);
11553 __Pyx_TraceCall(
"__get__", __pyx_f[2], 555, 0, __PYX_ERR(2, 555, __pyx_L1_error));
11562 __Pyx_TraceLine(556,0,__PYX_ERR(2, 556, __pyx_L1_error))
11563 __pyx_t_1 = __pyx_memoryview_copy_object(__pyx_v_self);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 556, __pyx_L1_error)
11564 __Pyx_GOTREF(__pyx_t_1);
11565 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_memoryviewslice_type))))) __PYX_ERR(2, 556, __pyx_L1_error)
11566 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_1);
11576 __Pyx_TraceLine(557,0,__PYX_ERR(2, 557, __pyx_L1_error))
11577 __pyx_t_2 = __pyx_memslice_transpose((&__pyx_v_result->from_slice));
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(2, 557, __pyx_L1_error)
11586 __Pyx_TraceLine(558,0,__PYX_ERR(2, 558, __pyx_L1_error))
11587 __Pyx_XDECREF(__pyx_r);
11588 __Pyx_INCREF(((PyObject *)__pyx_v_result));
11589 __pyx_r = ((PyObject *)__pyx_v_result);
11602 __Pyx_XDECREF(__pyx_t_1);
11603 __Pyx_AddTraceback(
"View.MemoryView.memoryview.T.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11606 __Pyx_XDECREF((PyObject *)__pyx_v_result);
11607 __Pyx_XGIVEREF(__pyx_r);
11608 __Pyx_TraceReturn(__pyx_r, 0);
11609 __Pyx_RefNannyFinishContext();
11622 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self);
11623 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(PyObject *__pyx_v_self) {
11624 PyObject *__pyx_r = 0;
11625 __Pyx_RefNannyDeclarations
11626 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11627 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11630 __Pyx_RefNannyFinishContext();
11634 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4base___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11635 PyObject *__pyx_r = NULL;
11636 __Pyx_TraceDeclarations
11637 __Pyx_RefNannyDeclarations
11638 int __pyx_lineno = 0;
11639 const char *__pyx_filename = NULL;
11640 int __pyx_clineno = 0;
11641 __Pyx_RefNannySetupContext(
"__get__", 0);
11642 __Pyx_TraceCall(
"__get__", __pyx_f[2], 561, 0, __PYX_ERR(2, 561, __pyx_L1_error));
11651 __Pyx_TraceLine(562,0,__PYX_ERR(2, 562, __pyx_L1_error))
11652 __Pyx_XDECREF(__pyx_r);
11653 __Pyx_INCREF(__pyx_v_self->obj);
11654 __pyx_r = __pyx_v_self->obj;
11667 __Pyx_AddTraceback(
"View.MemoryView.memoryview.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11670 __Pyx_XGIVEREF(__pyx_r);
11671 __Pyx_TraceReturn(__pyx_r, 0);
11672 __Pyx_RefNannyFinishContext();
11685 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self);
11686 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(PyObject *__pyx_v_self) {
11687 PyObject *__pyx_r = 0;
11688 __Pyx_RefNannyDeclarations
11689 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11690 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11693 __Pyx_RefNannyFinishContext();
11697 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11698 Py_ssize_t __pyx_v_length;
11699 PyObject *__pyx_r = NULL;
11700 __Pyx_TraceDeclarations
11701 __Pyx_RefNannyDeclarations
11702 PyObject *__pyx_t_1 = NULL;
11703 Py_ssize_t *__pyx_t_2;
11704 Py_ssize_t *__pyx_t_3;
11705 Py_ssize_t *__pyx_t_4;
11706 PyObject *__pyx_t_5 = NULL;
11707 int __pyx_lineno = 0;
11708 const char *__pyx_filename = NULL;
11709 int __pyx_clineno = 0;
11710 __Pyx_RefNannySetupContext(
"__get__", 0);
11711 __Pyx_TraceCall(
"__get__", __pyx_f[2], 565, 0, __PYX_ERR(2, 565, __pyx_L1_error));
11720 __Pyx_TraceLine(566,0,__PYX_ERR(2, 566, __pyx_L1_error))
11721 __Pyx_XDECREF(__pyx_r);
11722 __pyx_t_1 = PyList_New(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 566, __pyx_L1_error)
11723 __Pyx_GOTREF(__pyx_t_1);
11724 __pyx_t_3 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
11725 for (__pyx_t_4 = __pyx_v_self->view.shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
11726 __pyx_t_2 = __pyx_t_4;
11727 __pyx_v_length = (__pyx_t_2[0]);
11728 __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_length);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
11729 __Pyx_GOTREF(__pyx_t_5);
11730 if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(2, 566, __pyx_L1_error)
11731 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
11733 __pyx_t_5 = PyList_AsTuple(((PyObject*)__pyx_t_1));
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 566, __pyx_L1_error)
11734 __Pyx_GOTREF(__pyx_t_5);
11735 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11736 __pyx_r = __pyx_t_5;
11750 __Pyx_XDECREF(__pyx_t_1);
11751 __Pyx_XDECREF(__pyx_t_5);
11752 __Pyx_AddTraceback(
"View.MemoryView.memoryview.shape.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11755 __Pyx_XGIVEREF(__pyx_r);
11756 __Pyx_TraceReturn(__pyx_r, 0);
11757 __Pyx_RefNannyFinishContext();
11770 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self);
11771 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(PyObject *__pyx_v_self) {
11772 PyObject *__pyx_r = 0;
11773 __Pyx_RefNannyDeclarations
11774 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11775 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11778 __Pyx_RefNannyFinishContext();
11782 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11783 Py_ssize_t __pyx_v_stride;
11784 PyObject *__pyx_r = NULL;
11785 __Pyx_TraceDeclarations
11786 __Pyx_RefNannyDeclarations
11788 PyObject *__pyx_t_2 = NULL;
11789 Py_ssize_t *__pyx_t_3;
11790 Py_ssize_t *__pyx_t_4;
11791 Py_ssize_t *__pyx_t_5;
11792 PyObject *__pyx_t_6 = NULL;
11793 int __pyx_lineno = 0;
11794 const char *__pyx_filename = NULL;
11795 int __pyx_clineno = 0;
11796 __Pyx_RefNannySetupContext(
"__get__", 0);
11797 __Pyx_TraceCall(
"__get__", __pyx_f[2], 569, 0, __PYX_ERR(2, 569, __pyx_L1_error));
11806 __Pyx_TraceLine(570,0,__PYX_ERR(2, 570, __pyx_L1_error))
11807 __pyx_t_1 = ((__pyx_v_self->view.strides == NULL) != 0);
11808 if (unlikely(__pyx_t_1)) {
11817 __Pyx_TraceLine(572,0,__PYX_ERR(2, 572, __pyx_L1_error))
11818 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 572, __pyx_L1_error)
11819 __Pyx_GOTREF(__pyx_t_2);
11820 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
11821 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11822 __PYX_ERR(2, 572, __pyx_L1_error)
11840 __Pyx_TraceLine(574,0,__PYX_ERR(2, 574, __pyx_L1_error))
11841 __Pyx_XDECREF(__pyx_r);
11842 __pyx_t_2 = PyList_New(0);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 574, __pyx_L1_error)
11843 __Pyx_GOTREF(__pyx_t_2);
11844 __pyx_t_4 = (__pyx_v_self->view.strides + __pyx_v_self->view.ndim);
11845 for (__pyx_t_5 = __pyx_v_self->view.strides; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
11846 __pyx_t_3 = __pyx_t_5;
11847 __pyx_v_stride = (__pyx_t_3[0]);
11848 __pyx_t_6 = PyInt_FromSsize_t(__pyx_v_stride);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
11849 __Pyx_GOTREF(__pyx_t_6);
11850 if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(2, 574, __pyx_L1_error)
11851 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
11853 __pyx_t_6 = PyList_AsTuple(((PyObject*)__pyx_t_2));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 574, __pyx_L1_error)
11854 __Pyx_GOTREF(__pyx_t_6);
11855 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11856 __pyx_r = __pyx_t_6;
11870 __Pyx_XDECREF(__pyx_t_2);
11871 __Pyx_XDECREF(__pyx_t_6);
11872 __Pyx_AddTraceback(
"View.MemoryView.memoryview.strides.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11875 __Pyx_XGIVEREF(__pyx_r);
11876 __Pyx_TraceReturn(__pyx_r, 0);
11877 __Pyx_RefNannyFinishContext();
11890 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self);
11891 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(PyObject *__pyx_v_self) {
11892 PyObject *__pyx_r = 0;
11893 __Pyx_RefNannyDeclarations
11894 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
11895 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
11898 __Pyx_RefNannyFinishContext();
11902 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
11903 Py_ssize_t __pyx_v_suboffset;
11904 PyObject *__pyx_r = NULL;
11905 __Pyx_TraceDeclarations
11906 __Pyx_RefNannyDeclarations
11908 PyObject *__pyx_t_2 = NULL;
11909 PyObject *__pyx_t_3 = NULL;
11910 Py_ssize_t *__pyx_t_4;
11911 Py_ssize_t *__pyx_t_5;
11912 Py_ssize_t *__pyx_t_6;
11913 int __pyx_lineno = 0;
11914 const char *__pyx_filename = NULL;
11915 int __pyx_clineno = 0;
11916 __Pyx_RefNannySetupContext(
"__get__", 0);
11917 __Pyx_TraceCall(
"__get__", __pyx_f[2], 577, 0, __PYX_ERR(2, 577, __pyx_L1_error));
11926 __Pyx_TraceLine(578,0,__PYX_ERR(2, 578, __pyx_L1_error))
11927 __pyx_t_1 = ((__pyx_v_self->view.suboffsets == NULL) != 0);
11937 __Pyx_TraceLine(579,0,__PYX_ERR(2, 579, __pyx_L1_error))
11938 __Pyx_XDECREF(__pyx_r);
11939 __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 579, __pyx_L1_error)
11940 __Pyx_GOTREF(__pyx_t_2);
11941 __pyx_t_3 = PyNumber_Multiply(__pyx_tuple__14, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 579, __pyx_L1_error)
11942 __Pyx_GOTREF(__pyx_t_3);
11943 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11944 __pyx_r = __pyx_t_3;
11964 __Pyx_TraceLine(581,0,__PYX_ERR(2, 581, __pyx_L1_error))
11965 __Pyx_XDECREF(__pyx_r);
11966 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 581, __pyx_L1_error)
11967 __Pyx_GOTREF(__pyx_t_3);
11968 __pyx_t_5 = (__pyx_v_self->view.suboffsets + __pyx_v_self->view.ndim);
11969 for (__pyx_t_6 = __pyx_v_self->view.suboffsets; __pyx_t_6 < __pyx_t_5; __pyx_t_6++) {
11970 __pyx_t_4 = __pyx_t_6;
11971 __pyx_v_suboffset = (__pyx_t_4[0]);
11972 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_suboffset);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
11973 __Pyx_GOTREF(__pyx_t_2);
11974 if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) __PYX_ERR(2, 581, __pyx_L1_error)
11975 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11977 __pyx_t_2 = PyList_AsTuple(((PyObject*)__pyx_t_3));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 581, __pyx_L1_error)
11978 __Pyx_GOTREF(__pyx_t_2);
11979 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
11980 __pyx_r = __pyx_t_2;
11994 __Pyx_XDECREF(__pyx_t_2);
11995 __Pyx_XDECREF(__pyx_t_3);
11996 __Pyx_AddTraceback(
"View.MemoryView.memoryview.suboffsets.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
11999 __Pyx_XGIVEREF(__pyx_r);
12000 __Pyx_TraceReturn(__pyx_r, 0);
12001 __Pyx_RefNannyFinishContext();
12014 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self);
12015 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(PyObject *__pyx_v_self) {
12016 PyObject *__pyx_r = 0;
12017 __Pyx_RefNannyDeclarations
12018 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12019 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12022 __Pyx_RefNannyFinishContext();
12026 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12027 PyObject *__pyx_r = NULL;
12028 __Pyx_TraceDeclarations
12029 __Pyx_RefNannyDeclarations
12030 PyObject *__pyx_t_1 = NULL;
12031 int __pyx_lineno = 0;
12032 const char *__pyx_filename = NULL;
12033 int __pyx_clineno = 0;
12034 __Pyx_RefNannySetupContext(
"__get__", 0);
12035 __Pyx_TraceCall(
"__get__", __pyx_f[2], 584, 0, __PYX_ERR(2, 584, __pyx_L1_error));
12044 __Pyx_TraceLine(585,0,__PYX_ERR(2, 585, __pyx_L1_error))
12045 __Pyx_XDECREF(__pyx_r);
12046 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->view.ndim);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 585, __pyx_L1_error)
12047 __Pyx_GOTREF(__pyx_t_1);
12048 __pyx_r = __pyx_t_1;
12062 __Pyx_XDECREF(__pyx_t_1);
12063 __Pyx_AddTraceback(
"View.MemoryView.memoryview.ndim.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12066 __Pyx_XGIVEREF(__pyx_r);
12067 __Pyx_TraceReturn(__pyx_r, 0);
12068 __Pyx_RefNannyFinishContext();
12081 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self);
12082 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(PyObject *__pyx_v_self) {
12083 PyObject *__pyx_r = 0;
12084 __Pyx_RefNannyDeclarations
12085 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12086 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12089 __Pyx_RefNannyFinishContext();
12093 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12094 PyObject *__pyx_r = NULL;
12095 __Pyx_TraceDeclarations
12096 __Pyx_RefNannyDeclarations
12097 PyObject *__pyx_t_1 = NULL;
12098 int __pyx_lineno = 0;
12099 const char *__pyx_filename = NULL;
12100 int __pyx_clineno = 0;
12101 __Pyx_RefNannySetupContext(
"__get__", 0);
12102 __Pyx_TraceCall(
"__get__", __pyx_f[2], 588, 0, __PYX_ERR(2, 588, __pyx_L1_error));
12111 __Pyx_TraceLine(589,0,__PYX_ERR(2, 589, __pyx_L1_error))
12112 __Pyx_XDECREF(__pyx_r);
12113 __pyx_t_1 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 589, __pyx_L1_error)
12114 __Pyx_GOTREF(__pyx_t_1);
12115 __pyx_r = __pyx_t_1;
12129 __Pyx_XDECREF(__pyx_t_1);
12130 __Pyx_AddTraceback(
"View.MemoryView.memoryview.itemsize.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12133 __Pyx_XGIVEREF(__pyx_r);
12134 __Pyx_TraceReturn(__pyx_r, 0);
12135 __Pyx_RefNannyFinishContext();
12148 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self);
12149 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(PyObject *__pyx_v_self) {
12150 PyObject *__pyx_r = 0;
12151 __Pyx_RefNannyDeclarations
12152 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12153 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12156 __Pyx_RefNannyFinishContext();
12160 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12161 PyObject *__pyx_r = NULL;
12162 __Pyx_TraceDeclarations
12163 __Pyx_RefNannyDeclarations
12164 PyObject *__pyx_t_1 = NULL;
12165 PyObject *__pyx_t_2 = NULL;
12166 PyObject *__pyx_t_3 = NULL;
12167 int __pyx_lineno = 0;
12168 const char *__pyx_filename = NULL;
12169 int __pyx_clineno = 0;
12170 __Pyx_RefNannySetupContext(
"__get__", 0);
12171 __Pyx_TraceCall(
"__get__", __pyx_f[2], 592, 0, __PYX_ERR(2, 592, __pyx_L1_error));
12180 __Pyx_TraceLine(593,0,__PYX_ERR(2, 593, __pyx_L1_error))
12181 __Pyx_XDECREF(__pyx_r);
12182 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_size);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 593, __pyx_L1_error)
12183 __Pyx_GOTREF(__pyx_t_1);
12184 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_self->view.itemsize);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 593, __pyx_L1_error)
12185 __Pyx_GOTREF(__pyx_t_2);
12186 __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 593, __pyx_L1_error)
12187 __Pyx_GOTREF(__pyx_t_3);
12188 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12189 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12190 __pyx_r = __pyx_t_3;
12204 __Pyx_XDECREF(__pyx_t_1);
12205 __Pyx_XDECREF(__pyx_t_2);
12206 __Pyx_XDECREF(__pyx_t_3);
12207 __Pyx_AddTraceback(
"View.MemoryView.memoryview.nbytes.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12210 __Pyx_XGIVEREF(__pyx_r);
12211 __Pyx_TraceReturn(__pyx_r, 0);
12212 __Pyx_RefNannyFinishContext();
12225 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self);
12226 static PyObject *__pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(PyObject *__pyx_v_self) {
12227 PyObject *__pyx_r = 0;
12228 __Pyx_RefNannyDeclarations
12229 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
12230 __pyx_r = __pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12233 __Pyx_RefNannyFinishContext();
12237 static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12238 PyObject *__pyx_v_result = NULL;
12239 PyObject *__pyx_v_length = NULL;
12240 PyObject *__pyx_r = NULL;
12241 __Pyx_TraceDeclarations
12242 __Pyx_RefNannyDeclarations
12245 Py_ssize_t *__pyx_t_3;
12246 Py_ssize_t *__pyx_t_4;
12247 Py_ssize_t *__pyx_t_5;
12248 PyObject *__pyx_t_6 = NULL;
12249 int __pyx_lineno = 0;
12250 const char *__pyx_filename = NULL;
12251 int __pyx_clineno = 0;
12252 __Pyx_RefNannySetupContext(
"__get__", 0);
12253 __Pyx_TraceCall(
"__get__", __pyx_f[2], 596, 0, __PYX_ERR(2, 596, __pyx_L1_error));
12262 __Pyx_TraceLine(597,0,__PYX_ERR(2, 597, __pyx_L1_error))
12263 __pyx_t_1 = (__pyx_v_self->_size == Py_None);
12264 __pyx_t_2 = (__pyx_t_1 != 0);
12274 __Pyx_TraceLine(598,0,__PYX_ERR(2, 598, __pyx_L1_error))
12275 __Pyx_INCREF(__pyx_int_1);
12276 __pyx_v_result = __pyx_int_1;
12285 __Pyx_TraceLine(600,0,__PYX_ERR(2, 600, __pyx_L1_error))
12286 __pyx_t_4 = (__pyx_v_self->view.shape + __pyx_v_self->view.ndim);
12287 for (__pyx_t_5 = __pyx_v_self->view.shape; __pyx_t_5 < __pyx_t_4; __pyx_t_5++) {
12288 __pyx_t_3 = __pyx_t_5;
12289 __pyx_t_6 = PyInt_FromSsize_t((__pyx_t_3[0]));
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 600, __pyx_L1_error)
12290 __Pyx_GOTREF(__pyx_t_6);
12291 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_6);
12301 __Pyx_TraceLine(601,0,__PYX_ERR(2, 601, __pyx_L1_error))
12302 __pyx_t_6 = PyNumber_InPlaceMultiply(__pyx_v_result, __pyx_v_length);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 601, __pyx_L1_error)
12303 __Pyx_GOTREF(__pyx_t_6);
12304 __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_6);
12315 __Pyx_TraceLine(603,0,__PYX_ERR(2, 603, __pyx_L1_error))
12316 __Pyx_INCREF(__pyx_v_result);
12317 __Pyx_GIVEREF(__pyx_v_result);
12318 __Pyx_GOTREF(__pyx_v_self->_size);
12319 __Pyx_DECREF(__pyx_v_self->_size);
12320 __pyx_v_self->_size = __pyx_v_result;
12338 __Pyx_TraceLine(605,0,__PYX_ERR(2, 605, __pyx_L1_error))
12339 __Pyx_XDECREF(__pyx_r);
12340 __Pyx_INCREF(__pyx_v_self->_size);
12341 __pyx_r = __pyx_v_self->_size;
12354 __Pyx_XDECREF(__pyx_t_6);
12355 __Pyx_AddTraceback(
"View.MemoryView.memoryview.size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12358 __Pyx_XDECREF(__pyx_v_result);
12359 __Pyx_XDECREF(__pyx_v_length);
12360 __Pyx_XGIVEREF(__pyx_r);
12361 __Pyx_TraceReturn(__pyx_r, 0);
12362 __Pyx_RefNannyFinishContext();
12375 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self);
12376 static Py_ssize_t __pyx_memoryview___len__(PyObject *__pyx_v_self) {
12377 Py_ssize_t __pyx_r;
12378 __Pyx_RefNannyDeclarations
12379 __Pyx_RefNannySetupContext(
"__len__ (wrapper)", 0);
12380 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12383 __Pyx_RefNannyFinishContext();
12387 static Py_ssize_t __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_10__len__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12388 Py_ssize_t __pyx_r;
12389 __Pyx_TraceDeclarations
12390 __Pyx_RefNannyDeclarations
12392 int __pyx_lineno = 0;
12393 const char *__pyx_filename = NULL;
12394 int __pyx_clineno = 0;
12395 __Pyx_RefNannySetupContext(
"__len__", 0);
12396 __Pyx_TraceCall(
"__len__", __pyx_f[2], 607, 0, __PYX_ERR(2, 607, __pyx_L1_error));
12405 __Pyx_TraceLine(608,0,__PYX_ERR(2, 608, __pyx_L1_error))
12406 __pyx_t_1 = ((__pyx_v_self->view.ndim >= 1) != 0);
12416 __Pyx_TraceLine(609,0,__PYX_ERR(2, 609, __pyx_L1_error))
12417 __pyx_r = (__pyx_v_self->view.shape[0]);
12436 __Pyx_TraceLine(611,0,__PYX_ERR(2, 611, __pyx_L1_error))
12450 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12453 __Pyx_TraceReturn(Py_None, 0);
12454 __Pyx_RefNannyFinishContext();
12467 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self);
12468 static PyObject *__pyx_memoryview___repr__(PyObject *__pyx_v_self) {
12469 PyObject *__pyx_r = 0;
12470 __Pyx_RefNannyDeclarations
12471 __Pyx_RefNannySetupContext(
"__repr__ (wrapper)", 0);
12472 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12475 __Pyx_RefNannyFinishContext();
12479 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12__repr__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12480 PyObject *__pyx_r = NULL;
12481 __Pyx_TraceDeclarations
12482 __Pyx_RefNannyDeclarations
12483 PyObject *__pyx_t_1 = NULL;
12484 PyObject *__pyx_t_2 = NULL;
12485 PyObject *__pyx_t_3 = NULL;
12486 int __pyx_lineno = 0;
12487 const char *__pyx_filename = NULL;
12488 int __pyx_clineno = 0;
12489 __Pyx_RefNannySetupContext(
"__repr__", 0);
12490 __Pyx_TraceCall(
"__repr__", __pyx_f[2], 613, 0, __PYX_ERR(2, 613, __pyx_L1_error));
12499 __Pyx_TraceLine(614,0,__PYX_ERR(2, 614, __pyx_L1_error))
12500 __Pyx_XDECREF(__pyx_r);
12501 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
12502 __Pyx_GOTREF(__pyx_t_1);
12503 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
12504 __Pyx_GOTREF(__pyx_t_2);
12505 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12506 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 614, __pyx_L1_error)
12507 __Pyx_GOTREF(__pyx_t_1);
12508 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12517 __Pyx_TraceLine(615,0,__PYX_ERR(2, 615, __pyx_L1_error))
12518 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 615, __pyx_L1_error)
12519 __Pyx_GOTREF(__pyx_t_2);
12528 __Pyx_TraceLine(614,0,__PYX_ERR(2, 614, __pyx_L1_error))
12529 __pyx_t_3 = PyTuple_New(2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 614, __pyx_L1_error)
12530 __Pyx_GOTREF(__pyx_t_3);
12531 __Pyx_GIVEREF(__pyx_t_1);
12532 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
12533 __Pyx_GIVEREF(__pyx_t_2);
12534 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
12537 __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_t_3);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 614, __pyx_L1_error)
12538 __Pyx_GOTREF(__pyx_t_2);
12539 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
12540 __pyx_r = __pyx_t_2;
12554 __Pyx_XDECREF(__pyx_t_1);
12555 __Pyx_XDECREF(__pyx_t_2);
12556 __Pyx_XDECREF(__pyx_t_3);
12557 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12560 __Pyx_XGIVEREF(__pyx_r);
12561 __Pyx_TraceReturn(__pyx_r, 0);
12562 __Pyx_RefNannyFinishContext();
12575 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self);
12576 static PyObject *__pyx_memoryview___str__(PyObject *__pyx_v_self) {
12577 PyObject *__pyx_r = 0;
12578 __Pyx_RefNannyDeclarations
12579 __Pyx_RefNannySetupContext(
"__str__ (wrapper)", 0);
12580 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12583 __Pyx_RefNannyFinishContext();
12587 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14__str__(
struct __pyx_memoryview_obj *__pyx_v_self) {
12588 PyObject *__pyx_r = NULL;
12589 __Pyx_TraceDeclarations
12590 __Pyx_RefNannyDeclarations
12591 PyObject *__pyx_t_1 = NULL;
12592 PyObject *__pyx_t_2 = NULL;
12593 int __pyx_lineno = 0;
12594 const char *__pyx_filename = NULL;
12595 int __pyx_clineno = 0;
12596 __Pyx_RefNannySetupContext(
"__str__", 0);
12597 __Pyx_TraceCall(
"__str__", __pyx_f[2], 617, 0, __PYX_ERR(2, 617, __pyx_L1_error));
12606 __Pyx_TraceLine(618,0,__PYX_ERR(2, 618, __pyx_L1_error))
12607 __Pyx_XDECREF(__pyx_r);
12608 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_base);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12609 __Pyx_GOTREF(__pyx_t_1);
12610 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_class);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
12611 __Pyx_GOTREF(__pyx_t_2);
12612 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
12613 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_name_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12614 __Pyx_GOTREF(__pyx_t_1);
12615 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12616 __pyx_t_2 = PyTuple_New(1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 618, __pyx_L1_error)
12617 __Pyx_GOTREF(__pyx_t_2);
12618 __Pyx_GIVEREF(__pyx_t_1);
12619 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
12621 __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_MemoryView_of_r_object, __pyx_t_2);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 618, __pyx_L1_error)
12622 __Pyx_GOTREF(__pyx_t_1);
12623 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
12624 __pyx_r = __pyx_t_1;
12638 __Pyx_XDECREF(__pyx_t_1);
12639 __Pyx_XDECREF(__pyx_t_2);
12640 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename);
12643 __Pyx_XGIVEREF(__pyx_r);
12644 __Pyx_TraceReturn(__pyx_r, 0);
12645 __Pyx_RefNannyFinishContext();
12658 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12659 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_17is_c_contig = {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0};
12660 static PyObject *__pyx_memoryview_is_c_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12661 PyObject *__pyx_r = 0;
12662 __Pyx_RefNannyDeclarations
12663 __Pyx_RefNannySetupContext(
"is_c_contig (wrapper)", 0);
12664 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12667 __Pyx_RefNannyFinishContext();
12671 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16is_c_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
12672 __Pyx_memviewslice *__pyx_v_mslice;
12673 __Pyx_memviewslice __pyx_v_tmp;
12674 PyObject *__pyx_r = NULL;
12675 __Pyx_TraceDeclarations
12676 __Pyx_RefNannyDeclarations
12677 __Pyx_memviewslice *__pyx_t_1;
12678 PyObject *__pyx_t_2 = NULL;
12679 int __pyx_lineno = 0;
12680 const char *__pyx_filename = NULL;
12681 int __pyx_clineno = 0;
12682 __Pyx_RefNannySetupContext(
"is_c_contig", 0);
12683 __Pyx_TraceCall(
"is_c_contig", __pyx_f[2], 621, 0, __PYX_ERR(2, 621, __pyx_L1_error));
12692 __Pyx_TraceLine(624,0,__PYX_ERR(2, 624, __pyx_L1_error))
12693 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 624, __pyx_L1_error)
12694 __pyx_v_mslice = __pyx_t_1;
12703 __Pyx_TraceLine(625,0,__PYX_ERR(2, 625, __pyx_L1_error))
12704 __Pyx_XDECREF(__pyx_r);
12705 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'C', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 625, __pyx_L1_error)
12706 __Pyx_GOTREF(__pyx_t_2);
12707 __pyx_r = __pyx_t_2;
12721 __Pyx_XDECREF(__pyx_t_2);
12722 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_c_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12725 __Pyx_XGIVEREF(__pyx_r);
12726 __Pyx_TraceReturn(__pyx_r, 0);
12727 __Pyx_RefNannyFinishContext();
12740 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12741 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_19is_f_contig = {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0};
12742 static PyObject *__pyx_memoryview_is_f_contig(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12743 PyObject *__pyx_r = 0;
12744 __Pyx_RefNannyDeclarations
12745 __Pyx_RefNannySetupContext(
"is_f_contig (wrapper)", 0);
12746 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12749 __Pyx_RefNannyFinishContext();
12753 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18is_f_contig(
struct __pyx_memoryview_obj *__pyx_v_self) {
12754 __Pyx_memviewslice *__pyx_v_mslice;
12755 __Pyx_memviewslice __pyx_v_tmp;
12756 PyObject *__pyx_r = NULL;
12757 __Pyx_TraceDeclarations
12758 __Pyx_RefNannyDeclarations
12759 __Pyx_memviewslice *__pyx_t_1;
12760 PyObject *__pyx_t_2 = NULL;
12761 int __pyx_lineno = 0;
12762 const char *__pyx_filename = NULL;
12763 int __pyx_clineno = 0;
12764 __Pyx_RefNannySetupContext(
"is_f_contig", 0);
12765 __Pyx_TraceCall(
"is_f_contig", __pyx_f[2], 627, 0, __PYX_ERR(2, 627, __pyx_L1_error));
12774 __Pyx_TraceLine(630,0,__PYX_ERR(2, 630, __pyx_L1_error))
12775 __pyx_t_1 = __pyx_memoryview_get_slice_from_memoryview(__pyx_v_self, (&__pyx_v_tmp));
if (unlikely(__pyx_t_1 == ((__Pyx_memviewslice *)NULL))) __PYX_ERR(2, 630, __pyx_L1_error)
12776 __pyx_v_mslice = __pyx_t_1;
12785 __Pyx_TraceLine(631,0,__PYX_ERR(2, 631, __pyx_L1_error))
12786 __Pyx_XDECREF(__pyx_r);
12787 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_memviewslice_is_contig((__pyx_v_mslice[0]),
'F', __pyx_v_self->view.ndim));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 631, __pyx_L1_error)
12788 __Pyx_GOTREF(__pyx_t_2);
12789 __pyx_r = __pyx_t_2;
12803 __Pyx_XDECREF(__pyx_t_2);
12804 __Pyx_AddTraceback(
"View.MemoryView.memoryview.is_f_contig", __pyx_clineno, __pyx_lineno, __pyx_filename);
12807 __Pyx_XGIVEREF(__pyx_r);
12808 __Pyx_TraceReturn(__pyx_r, 0);
12809 __Pyx_RefNannyFinishContext();
12822 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12823 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_21copy = {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0};
12824 static PyObject *__pyx_memoryview_copy(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12825 PyObject *__pyx_r = 0;
12826 __Pyx_RefNannyDeclarations
12827 __Pyx_RefNannySetupContext(
"copy (wrapper)", 0);
12828 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12831 __Pyx_RefNannyFinishContext();
12835 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20copy(
struct __pyx_memoryview_obj *__pyx_v_self) {
12836 __Pyx_memviewslice __pyx_v_mslice;
12838 PyObject *__pyx_r = NULL;
12839 __Pyx_TraceDeclarations
12840 __Pyx_RefNannyDeclarations
12841 __Pyx_memviewslice __pyx_t_1;
12842 PyObject *__pyx_t_2 = NULL;
12843 int __pyx_lineno = 0;
12844 const char *__pyx_filename = NULL;
12845 int __pyx_clineno = 0;
12846 __Pyx_RefNannySetupContext(
"copy", 0);
12847 __Pyx_TraceCall(
"copy", __pyx_f[2], 633, 0, __PYX_ERR(2, 633, __pyx_L1_error));
12856 __Pyx_TraceLine(635,0,__PYX_ERR(2, 635, __pyx_L1_error))
12857 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_F_CONTIGUOUS));
12866 __Pyx_TraceLine(637,0,__PYX_ERR(2, 637, __pyx_L1_error))
12867 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_mslice));
12876 __Pyx_TraceLine(638,0,__PYX_ERR(2, 638, __pyx_L1_error))
12877 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_mslice), ((
char *)
"c"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_C_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 638, __pyx_L1_error)
12878 __pyx_v_mslice = __pyx_t_1;
12887 __Pyx_TraceLine(643,0,__PYX_ERR(2, 643, __pyx_L1_error))
12888 __Pyx_XDECREF(__pyx_r);
12889 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_mslice));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 643, __pyx_L1_error)
12890 __Pyx_GOTREF(__pyx_t_2);
12891 __pyx_r = __pyx_t_2;
12905 __Pyx_XDECREF(__pyx_t_2);
12906 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
12909 __Pyx_XGIVEREF(__pyx_r);
12910 __Pyx_TraceReturn(__pyx_r, 0);
12911 __Pyx_RefNannyFinishContext();
12924 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
12925 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_10memoryview_23copy_fortran = {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0};
12926 static PyObject *__pyx_memoryview_copy_fortran(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
12927 PyObject *__pyx_r = 0;
12928 __Pyx_RefNannyDeclarations
12929 __Pyx_RefNannySetupContext(
"copy_fortran (wrapper)", 0);
12930 __pyx_r = __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(((
struct __pyx_memoryview_obj *)__pyx_v_self));
12933 __Pyx_RefNannyFinishContext();
12937 static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22copy_fortran(
struct __pyx_memoryview_obj *__pyx_v_self) {
12938 __Pyx_memviewslice __pyx_v_src;
12939 __Pyx_memviewslice __pyx_v_dst;
12941 PyObject *__pyx_r = NULL;
12942 __Pyx_TraceDeclarations
12943 __Pyx_RefNannyDeclarations
12944 __Pyx_memviewslice __pyx_t_1;
12945 PyObject *__pyx_t_2 = NULL;
12946 int __pyx_lineno = 0;
12947 const char *__pyx_filename = NULL;
12948 int __pyx_clineno = 0;
12949 __Pyx_RefNannySetupContext(
"copy_fortran", 0);
12950 __Pyx_TraceCall(
"copy_fortran", __pyx_f[2], 645, 0, __PYX_ERR(2, 645, __pyx_L1_error));
12959 __Pyx_TraceLine(647,0,__PYX_ERR(2, 647, __pyx_L1_error))
12960 __pyx_v_flags = (__pyx_v_self->flags & (~PyBUF_C_CONTIGUOUS));
12969 __Pyx_TraceLine(649,0,__PYX_ERR(2, 649, __pyx_L1_error))
12970 __pyx_memoryview_slice_copy(__pyx_v_self, (&__pyx_v_src));
12979 __Pyx_TraceLine(650,0,__PYX_ERR(2, 650, __pyx_L1_error))
12980 __pyx_t_1 = __pyx_memoryview_copy_new_contig((&__pyx_v_src), ((
char *)
"fortran"), __pyx_v_self->view.ndim, __pyx_v_self->view.itemsize, (__pyx_v_flags | PyBUF_F_CONTIGUOUS), __pyx_v_self->dtype_is_object);
if (unlikely(PyErr_Occurred())) __PYX_ERR(2, 650, __pyx_L1_error)
12981 __pyx_v_dst = __pyx_t_1;
12990 __Pyx_TraceLine(655,0,__PYX_ERR(2, 655, __pyx_L1_error))
12991 __Pyx_XDECREF(__pyx_r);
12992 __pyx_t_2 = __pyx_memoryview_copy_object_from_slice(__pyx_v_self, (&__pyx_v_dst));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 655, __pyx_L1_error)
12993 __Pyx_GOTREF(__pyx_t_2);
12994 __pyx_r = __pyx_t_2;
13008 __Pyx_XDECREF(__pyx_t_2);
13009 __Pyx_AddTraceback(
"View.MemoryView.memoryview.copy_fortran", __pyx_clineno, __pyx_lineno, __pyx_filename);
13012 __Pyx_XGIVEREF(__pyx_r);
13013 __Pyx_TraceReturn(__pyx_r, 0);
13014 __Pyx_RefNannyFinishContext();
13025 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
13026 static PyMethodDef __pyx_mdef___pyx_memoryview_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0};
13027 static PyObject *__pyx_pw___pyx_memoryview_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
13028 PyObject *__pyx_r = 0;
13029 __Pyx_RefNannyDeclarations
13030 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
13031 __pyx_r = __pyx_pf___pyx_memoryview___reduce_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self));
13034 __Pyx_RefNannyFinishContext();
13038 static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self) {
13039 PyObject *__pyx_r = NULL;
13040 __Pyx_TraceDeclarations
13041 __Pyx_RefNannyDeclarations
13042 PyObject *__pyx_t_1 = NULL;
13043 int __pyx_lineno = 0;
13044 const char *__pyx_filename = NULL;
13045 int __pyx_clineno = 0;
13046 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
13047 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
13055 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
13056 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
13057 __Pyx_GOTREF(__pyx_t_1);
13058 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13059 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13060 __PYX_ERR(2, 2, __pyx_L1_error)
13070 __Pyx_XDECREF(__pyx_t_1);
13071 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13073 __Pyx_XGIVEREF(__pyx_r);
13074 __Pyx_TraceReturn(__pyx_r, 0);
13075 __Pyx_RefNannyFinishContext();
13087 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
13088 static PyMethodDef __pyx_mdef___pyx_memoryview_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0};
13089 static PyObject *__pyx_pw___pyx_memoryview_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
13090 PyObject *__pyx_r = 0;
13091 __Pyx_RefNannyDeclarations
13092 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
13093 __pyx_r = __pyx_pf___pyx_memoryview_2__setstate_cython__(((
struct __pyx_memoryview_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
13096 __Pyx_RefNannyFinishContext();
13100 static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryview_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
13101 PyObject *__pyx_r = NULL;
13102 __Pyx_TraceDeclarations
13103 __Pyx_RefNannyDeclarations
13104 PyObject *__pyx_t_1 = NULL;
13105 int __pyx_lineno = 0;
13106 const char *__pyx_filename = NULL;
13107 int __pyx_clineno = 0;
13108 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
13109 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
13116 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
13117 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__16, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
13118 __Pyx_GOTREF(__pyx_t_1);
13119 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
13120 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
13121 __PYX_ERR(2, 4, __pyx_L1_error)
13132 __Pyx_XDECREF(__pyx_t_1);
13133 __Pyx_AddTraceback(
"View.MemoryView.memoryview.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
13135 __Pyx_XGIVEREF(__pyx_r);
13136 __Pyx_TraceReturn(__pyx_r, 0);
13137 __Pyx_RefNannyFinishContext();
13149 static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o,
int __pyx_v_flags,
int __pyx_v_dtype_is_object, __Pyx_TypeInfo *__pyx_v_typeinfo) {
13150 struct __pyx_memoryview_obj *__pyx_v_result = 0;
13151 PyObject *__pyx_r = NULL;
13152 __Pyx_TraceDeclarations
13153 __Pyx_RefNannyDeclarations
13154 PyObject *__pyx_t_1 = NULL;
13155 PyObject *__pyx_t_2 = NULL;
13156 PyObject *__pyx_t_3 = NULL;
13157 int __pyx_lineno = 0;
13158 const char *__pyx_filename = NULL;
13159 int __pyx_clineno = 0;
13160 __Pyx_RefNannySetupContext(
"memoryview_cwrapper", 0);
13161 __Pyx_TraceCall(
"memoryview_cwrapper", __pyx_f[2], 659, 0, __PYX_ERR(2, 659, __pyx_L1_error));
13170 __Pyx_TraceLine(660,0,__PYX_ERR(2, 660, __pyx_L1_error))
13171 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_flags);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 660, __pyx_L1_error)
13172 __Pyx_GOTREF(__pyx_t_1);
13173 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
13174 __Pyx_GOTREF(__pyx_t_2);
13175 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 660, __pyx_L1_error)
13176 __Pyx_GOTREF(__pyx_t_3);
13177 __Pyx_INCREF(__pyx_v_o);
13178 __Pyx_GIVEREF(__pyx_v_o);
13179 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_o);
13180 __Pyx_GIVEREF(__pyx_t_1);
13181 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
13182 __Pyx_GIVEREF(__pyx_t_2);
13183 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
13186 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryview_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 660, __pyx_L1_error)
13187 __Pyx_GOTREF(__pyx_t_2);
13188 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13189 __pyx_v_result = ((
struct __pyx_memoryview_obj *)__pyx_t_2);
13199 __Pyx_TraceLine(661,0,__PYX_ERR(2, 661, __pyx_L1_error))
13200 __pyx_v_result->typeinfo = __pyx_v_typeinfo;
13209 __Pyx_TraceLine(662,0,__PYX_ERR(2, 662, __pyx_L1_error))
13210 __Pyx_XDECREF(__pyx_r);
13211 __Pyx_INCREF(((PyObject *)__pyx_v_result));
13212 __pyx_r = ((PyObject *)__pyx_v_result);
13225 __Pyx_XDECREF(__pyx_t_1);
13226 __Pyx_XDECREF(__pyx_t_2);
13227 __Pyx_XDECREF(__pyx_t_3);
13228 __Pyx_AddTraceback(
"View.MemoryView.memoryview_cwrapper", __pyx_clineno, __pyx_lineno, __pyx_filename);
13231 __Pyx_XDECREF((PyObject *)__pyx_v_result);
13232 __Pyx_XGIVEREF(__pyx_r);
13233 __Pyx_TraceReturn(__pyx_r, 0);
13234 __Pyx_RefNannyFinishContext();
13246 static CYTHON_INLINE
int __pyx_memoryview_check(PyObject *__pyx_v_o) {
13248 __Pyx_TraceDeclarations
13249 __Pyx_RefNannyDeclarations
13251 int __pyx_lineno = 0;
13252 const char *__pyx_filename = NULL;
13253 int __pyx_clineno = 0;
13254 __Pyx_RefNannySetupContext(
"memoryview_check", 0);
13255 __Pyx_TraceCall(
"memoryview_check", __pyx_f[2], 665, 0, __PYX_ERR(2, 665, __pyx_L1_error));
13264 __Pyx_TraceLine(666,0,__PYX_ERR(2, 666, __pyx_L1_error))
13265 __pyx_t_1 = __Pyx_TypeCheck(__pyx_v_o, __pyx_memoryview_type);
13266 __pyx_r = __pyx_t_1;
13279 __Pyx_WriteUnraisable(
"View.MemoryView.memoryview_check", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
13282 __Pyx_TraceReturn(Py_None, 0);
13283 __Pyx_RefNannyFinishContext();
13295 static PyObject *_unellipsify(PyObject *__pyx_v_index,
int __pyx_v_ndim) {
13296 PyObject *__pyx_v_tup = NULL;
13297 PyObject *__pyx_v_result = NULL;
13298 int __pyx_v_have_slices;
13299 int __pyx_v_seen_ellipsis;
13300 CYTHON_UNUSED PyObject *__pyx_v_idx = NULL;
13301 PyObject *__pyx_v_item = NULL;
13302 Py_ssize_t __pyx_v_nslices;
13303 PyObject *__pyx_r = NULL;
13304 __Pyx_TraceDeclarations
13305 __Pyx_RefNannyDeclarations
13308 PyObject *__pyx_t_3 = NULL;
13309 PyObject *__pyx_t_4 = NULL;
13310 Py_ssize_t __pyx_t_5;
13311 PyObject *(*__pyx_t_6)(PyObject *);
13312 PyObject *__pyx_t_7 = NULL;
13313 Py_ssize_t __pyx_t_8;
13316 PyObject *__pyx_t_11 = NULL;
13317 int __pyx_lineno = 0;
13318 const char *__pyx_filename = NULL;
13319 int __pyx_clineno = 0;
13320 __Pyx_RefNannySetupContext(
"_unellipsify", 0);
13321 __Pyx_TraceCall(
"_unellipsify", __pyx_f[2], 668, 0, __PYX_ERR(2, 668, __pyx_L1_error));
13330 __Pyx_TraceLine(673,0,__PYX_ERR(2, 673, __pyx_L1_error))
13331 __pyx_t_1 = PyTuple_Check(__pyx_v_index);
13332 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
13342 __Pyx_TraceLine(674,0,__PYX_ERR(2, 674, __pyx_L1_error))
13343 __pyx_t_3 = PyTuple_New(1);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 674, __pyx_L1_error)
13344 __Pyx_GOTREF(__pyx_t_3);
13345 __Pyx_INCREF(__pyx_v_index);
13346 __Pyx_GIVEREF(__pyx_v_index);
13347 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_index);
13348 __pyx_v_tup = __pyx_t_3;
13368 __Pyx_TraceLine(676,0,__PYX_ERR(2, 676, __pyx_L1_error))
13370 __Pyx_INCREF(__pyx_v_index);
13371 __pyx_v_tup = __pyx_v_index;
13382 __Pyx_TraceLine(678,0,__PYX_ERR(2, 678, __pyx_L1_error))
13383 __pyx_t_3 = PyList_New(0);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 678, __pyx_L1_error)
13384 __Pyx_GOTREF(__pyx_t_3);
13385 __pyx_v_result = ((PyObject*)__pyx_t_3);
13395 __Pyx_TraceLine(679,0,__PYX_ERR(2, 679, __pyx_L1_error))
13396 __pyx_v_have_slices = 0;
13405 __Pyx_TraceLine(680,0,__PYX_ERR(2, 680, __pyx_L1_error))
13406 __pyx_v_seen_ellipsis = 0;
13415 __Pyx_TraceLine(681,0,__PYX_ERR(2, 681, __pyx_L1_error))
13416 __Pyx_INCREF(__pyx_int_0);
13417 __pyx_t_3 = __pyx_int_0;
13418 if (likely(PyList_CheckExact(__pyx_v_tup)) || PyTuple_CheckExact(__pyx_v_tup)) {
13419 __pyx_t_4 = __pyx_v_tup; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
13422 __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_tup);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 681, __pyx_L1_error)
13423 __Pyx_GOTREF(__pyx_t_4);
13424 __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext;
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 681, __pyx_L1_error)
13427 if (likely(!__pyx_t_6)) {
13428 if (likely(PyList_CheckExact(__pyx_t_4))) {
13429 if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4))
break;
13430 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13431 __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
13433 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13434 __Pyx_GOTREF(__pyx_t_7);
13437 if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4))
break;
13438 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13439 __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++;
if (unlikely(0 < 0)) __PYX_ERR(2, 681, __pyx_L1_error)
13441 __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++;
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13442 __Pyx_GOTREF(__pyx_t_7);
13446 __pyx_t_7 = __pyx_t_6(__pyx_t_4);
13447 if (unlikely(!__pyx_t_7)) {
13448 PyObject* exc_type = PyErr_Occurred();
13450 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
13451 else __PYX_ERR(2, 681, __pyx_L1_error)
13455 __Pyx_GOTREF(__pyx_t_7);
13457 __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_7);
13459 __Pyx_INCREF(__pyx_t_3);
13460 __Pyx_XDECREF_SET(__pyx_v_idx, __pyx_t_3);
13461 __pyx_t_7 = __Pyx_PyInt_AddObjC(__pyx_t_3, __pyx_int_1, 1, 0, 0);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 681, __pyx_L1_error)
13462 __Pyx_GOTREF(__pyx_t_7);
13463 __Pyx_DECREF(__pyx_t_3);
13464 __pyx_t_3 = __pyx_t_7;
13474 __Pyx_TraceLine(682,0,__PYX_ERR(2, 682, __pyx_L1_error))
13475 __pyx_t_2 = (__pyx_v_item == __pyx_builtin_Ellipsis);
13476 __pyx_t_1 = (__pyx_t_2 != 0);
13486 __Pyx_TraceLine(683,0,__PYX_ERR(2, 683, __pyx_L1_error))
13487 __pyx_t_1 = ((!(__pyx_v_seen_ellipsis != 0)) != 0);
13497 __Pyx_TraceLine(684,0,__PYX_ERR(2, 684, __pyx_L1_error))
13498 __pyx_t_8 = PyObject_Length(__pyx_v_tup);
if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
13499 __pyx_t_7 = PyList_New(1 * ((((__pyx_v_ndim - __pyx_t_8) + 1)<0) ? 0:((__pyx_v_ndim - __pyx_t_8) + 1)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 684, __pyx_L1_error)
13500 __Pyx_GOTREF(__pyx_t_7);
13501 { Py_ssize_t __pyx_temp;
13502 for (__pyx_temp=0; __pyx_temp < ((__pyx_v_ndim - __pyx_t_8) + 1); __pyx_temp++) {
13503 __Pyx_INCREF(__pyx_slice__17);
13504 __Pyx_GIVEREF(__pyx_slice__17);
13505 PyList_SET_ITEM(__pyx_t_7, __pyx_temp, __pyx_slice__17);
13508 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_7);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 684, __pyx_L1_error)
13509 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13518 __Pyx_TraceLine(685,0,__PYX_ERR(2, 685, __pyx_L1_error))
13519 __pyx_v_seen_ellipsis = 1;
13538 __Pyx_TraceLine(687,0,__PYX_ERR(2, 687, __pyx_L1_error))
13540 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_slice__17);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 687, __pyx_L1_error)
13551 __Pyx_TraceLine(688,0,__PYX_ERR(2, 688, __pyx_L1_error))
13552 __pyx_v_have_slices = 1;
13571 __Pyx_TraceLine(690,0,__PYX_ERR(2, 690, __pyx_L1_error))
13573 __pyx_t_2 = PySlice_Check(__pyx_v_item);
13574 __pyx_t_10 = ((!(__pyx_t_2 != 0)) != 0);
13577 __pyx_t_1 = __pyx_t_10;
13578 goto __pyx_L9_bool_binop_done;
13580 __pyx_t_10 = ((!(PyIndex_Check(__pyx_v_item) != 0)) != 0);
13581 __pyx_t_1 = __pyx_t_10;
13582 __pyx_L9_bool_binop_done:;
13583 if (unlikely(__pyx_t_1)) {
13592 __Pyx_TraceLine(691,0,__PYX_ERR(2, 691, __pyx_L1_error))
13593 __pyx_t_7 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Cannot_index_with_type_s, ((PyObject *)Py_TYPE(__pyx_v_item)));
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 691, __pyx_L1_error)
13594 __Pyx_GOTREF(__pyx_t_7);
13595 __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_builtin_TypeError, __pyx_t_7);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 691, __pyx_L1_error)
13596 __Pyx_GOTREF(__pyx_t_11);
13597 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
13598 __Pyx_Raise(__pyx_t_11, 0, 0, 0);
13599 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
13600 __PYX_ERR(2, 691, __pyx_L1_error)
13618 __Pyx_TraceLine(693,0,__PYX_ERR(2, 693, __pyx_L1_error))
13619 __pyx_t_10 = (__pyx_v_have_slices != 0);
13622 __pyx_t_1 = __pyx_t_10;
13623 goto __pyx_L11_bool_binop_done;
13625 __pyx_t_10 = PySlice_Check(__pyx_v_item);
13626 __pyx_t_2 = (__pyx_t_10 != 0);
13627 __pyx_t_1 = __pyx_t_2;
13628 __pyx_L11_bool_binop_done:;
13629 __pyx_v_have_slices = __pyx_t_1;
13638 __Pyx_TraceLine(694,0,__PYX_ERR(2, 694, __pyx_L1_error))
13639 __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_v_item);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 694, __pyx_L1_error)
13650 __Pyx_TraceLine(681,0,__PYX_ERR(2, 681, __pyx_L1_error))
13652 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
13653 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13662 __Pyx_TraceLine(696,0,__PYX_ERR(2, 696, __pyx_L1_error))
13663 __pyx_t_5 = PyList_GET_SIZE(__pyx_v_result);
if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(2, 696, __pyx_L1_error)
13664 __pyx_v_nslices = (__pyx_v_ndim - __pyx_t_5);
13673 __Pyx_TraceLine(697,0,__PYX_ERR(2, 697, __pyx_L1_error))
13674 __pyx_t_1 = (__pyx_v_nslices != 0);
13684 __Pyx_TraceLine(698,0,__PYX_ERR(2, 698, __pyx_L1_error))
13685 __pyx_t_3 = PyList_New(1 * ((__pyx_v_nslices<0) ? 0:__pyx_v_nslices));
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 698, __pyx_L1_error)
13686 __Pyx_GOTREF(__pyx_t_3);
13687 { Py_ssize_t __pyx_temp;
13688 for (__pyx_temp=0; __pyx_temp < __pyx_v_nslices; __pyx_temp++) {
13689 __Pyx_INCREF(__pyx_slice__17);
13690 __Pyx_GIVEREF(__pyx_slice__17);
13691 PyList_SET_ITEM(__pyx_t_3, __pyx_temp, __pyx_slice__17);
13694 __pyx_t_9 = __Pyx_PyList_Extend(__pyx_v_result, __pyx_t_3);
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 698, __pyx_L1_error)
13695 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
13713 __Pyx_TraceLine(700,0,__PYX_ERR(2, 700, __pyx_L1_error))
13714 __Pyx_XDECREF(__pyx_r);
13715 if (!__pyx_v_have_slices) {
13717 __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_have_slices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13718 __Pyx_GOTREF(__pyx_t_4);
13719 __pyx_t_3 = __pyx_t_4;
13721 goto __pyx_L14_bool_binop_done;
13723 __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_nslices);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13724 __Pyx_GOTREF(__pyx_t_4);
13725 __pyx_t_3 = __pyx_t_4;
13727 __pyx_L14_bool_binop_done:;
13728 __pyx_t_4 = PyList_AsTuple(__pyx_v_result);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 700, __pyx_L1_error)
13729 __Pyx_GOTREF(__pyx_t_4);
13730 __pyx_t_11 = PyTuple_New(2);
if (unlikely(!__pyx_t_11)) __PYX_ERR(2, 700, __pyx_L1_error)
13731 __Pyx_GOTREF(__pyx_t_11);
13732 __Pyx_GIVEREF(__pyx_t_3);
13733 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3);
13734 __Pyx_GIVEREF(__pyx_t_4);
13735 PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_4);
13738 __pyx_r = ((PyObject*)__pyx_t_11);
13752 __Pyx_XDECREF(__pyx_t_3);
13753 __Pyx_XDECREF(__pyx_t_4);
13754 __Pyx_XDECREF(__pyx_t_7);
13755 __Pyx_XDECREF(__pyx_t_11);
13756 __Pyx_AddTraceback(
"View.MemoryView._unellipsify", __pyx_clineno, __pyx_lineno, __pyx_filename);
13759 __Pyx_XDECREF(__pyx_v_tup);
13760 __Pyx_XDECREF(__pyx_v_result);
13761 __Pyx_XDECREF(__pyx_v_idx);
13762 __Pyx_XDECREF(__pyx_v_item);
13763 __Pyx_XGIVEREF(__pyx_r);
13764 __Pyx_TraceReturn(__pyx_r, 0);
13765 __Pyx_RefNannyFinishContext();
13777 static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets,
int __pyx_v_ndim) {
13778 Py_ssize_t __pyx_v_suboffset;
13779 PyObject *__pyx_r = NULL;
13780 __Pyx_TraceDeclarations
13781 __Pyx_RefNannyDeclarations
13782 Py_ssize_t *__pyx_t_1;
13783 Py_ssize_t *__pyx_t_2;
13784 Py_ssize_t *__pyx_t_3;
13786 PyObject *__pyx_t_5 = NULL;
13787 int __pyx_lineno = 0;
13788 const char *__pyx_filename = NULL;
13789 int __pyx_clineno = 0;
13790 __Pyx_RefNannySetupContext(
"assert_direct_dimensions", 0);
13791 __Pyx_TraceCall(
"assert_direct_dimensions", __pyx_f[2], 702, 0, __PYX_ERR(2, 702, __pyx_L1_error));
13800 __Pyx_TraceLine(703,0,__PYX_ERR(2, 703, __pyx_L1_error))
13801 __pyx_t_2 = (__pyx_v_suboffsets + __pyx_v_ndim);
13802 for (__pyx_t_3 = __pyx_v_suboffsets; __pyx_t_3 < __pyx_t_2; __pyx_t_3++) {
13803 __pyx_t_1 = __pyx_t_3;
13804 __pyx_v_suboffset = (__pyx_t_1[0]);
13813 __Pyx_TraceLine(704,0,__PYX_ERR(2, 704, __pyx_L1_error))
13814 __pyx_t_4 = ((__pyx_v_suboffset >= 0) != 0);
13815 if (unlikely(__pyx_t_4)) {
13824 __Pyx_TraceLine(705,0,__PYX_ERR(2, 705, __pyx_L1_error))
13825 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 705, __pyx_L1_error)
13826 __Pyx_GOTREF(__pyx_t_5);
13827 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
13828 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
13829 __PYX_ERR(2, 705, __pyx_L1_error)
13850 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
13853 __Pyx_XDECREF(__pyx_t_5);
13854 __Pyx_AddTraceback(
"View.MemoryView.assert_direct_dimensions", __pyx_clineno, __pyx_lineno, __pyx_filename);
13857 __Pyx_XGIVEREF(__pyx_r);
13858 __Pyx_TraceReturn(__pyx_r, 0);
13859 __Pyx_RefNannyFinishContext();
13871 static struct __pyx_memoryview_obj *__pyx_memview_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, PyObject *__pyx_v_indices) {
13872 int __pyx_v_new_ndim;
13873 int __pyx_v_suboffset_dim;
13875 __Pyx_memviewslice __pyx_v_src;
13876 __Pyx_memviewslice __pyx_v_dst;
13877 __Pyx_memviewslice *__pyx_v_p_src;
13878 struct __pyx_memoryviewslice_obj *__pyx_v_memviewsliceobj = 0;
13879 __Pyx_memviewslice *__pyx_v_p_dst;
13880 int *__pyx_v_p_suboffset_dim;
13881 Py_ssize_t __pyx_v_start;
13882 Py_ssize_t __pyx_v_stop;
13883 Py_ssize_t __pyx_v_step;
13884 int __pyx_v_have_start;
13885 int __pyx_v_have_stop;
13886 int __pyx_v_have_step;
13887 PyObject *__pyx_v_index = NULL;
13888 struct __pyx_memoryview_obj *__pyx_r = NULL;
13889 __Pyx_TraceDeclarations
13890 __Pyx_RefNannyDeclarations
13893 PyObject *__pyx_t_3 = NULL;
13894 struct __pyx_memoryview_obj *__pyx_t_4;
13897 Py_ssize_t __pyx_t_7;
13898 PyObject *(*__pyx_t_8)(PyObject *);
13899 PyObject *__pyx_t_9 = NULL;
13900 Py_ssize_t __pyx_t_10;
13902 Py_ssize_t __pyx_t_12;
13903 int __pyx_lineno = 0;
13904 const char *__pyx_filename = NULL;
13905 int __pyx_clineno = 0;
13906 __Pyx_RefNannySetupContext(
"memview_slice", 0);
13907 __Pyx_TraceCall(
"memview_slice", __pyx_f[2], 712, 0, __PYX_ERR(2, 712, __pyx_L1_error));
13916 __Pyx_TraceLine(713,0,__PYX_ERR(2, 713, __pyx_L1_error))
13917 __pyx_v_new_ndim = 0;
13918 __pyx_v_suboffset_dim = -1;
13927 __Pyx_TraceLine(720,0,__PYX_ERR(2, 720, __pyx_L1_error))
13928 (void)(memset((&__pyx_v_dst), 0, (
sizeof(__pyx_v_dst))));
13937 __Pyx_TraceLine(724,0,__PYX_ERR(2, 724, __pyx_L1_error))
13938 #ifndef CYTHON_WITHOUT_ASSERTIONS
13939 if (unlikely(__pyx_assertions_enabled())) {
13940 if (unlikely(!((__pyx_v_memview->view.ndim > 0) != 0))) {
13941 PyErr_SetNone(PyExc_AssertionError);
13942 __PYX_ERR(2, 724, __pyx_L1_error)
13954 __Pyx_TraceLine(726,0,__PYX_ERR(2, 726, __pyx_L1_error))
13955 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
13956 __pyx_t_2 = (__pyx_t_1 != 0);
13966 __Pyx_TraceLine(727,0,__PYX_ERR(2, 727, __pyx_L1_error))
13967 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 727, __pyx_L1_error)
13968 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
13969 __Pyx_INCREF(__pyx_t_3);
13970 __pyx_v_memviewsliceobj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
13980 __Pyx_TraceLine(728,0,__PYX_ERR(2, 728, __pyx_L1_error))
13981 __pyx_v_p_src = (&__pyx_v_memviewsliceobj->from_slice);
14000 __Pyx_TraceLine(730,0,__PYX_ERR(2, 730, __pyx_L1_error))
14002 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_src));
14011 __Pyx_TraceLine(731,0,__PYX_ERR(2, 731, __pyx_L1_error))
14012 __pyx_v_p_src = (&__pyx_v_src);
14023 __Pyx_TraceLine(737,0,__PYX_ERR(2, 737, __pyx_L1_error))
14024 __pyx_t_4 = __pyx_v_p_src->memview;
14025 __pyx_v_dst.memview = __pyx_t_4;
14034 __Pyx_TraceLine(738,0,__PYX_ERR(2, 738, __pyx_L1_error))
14035 __pyx_t_5 = __pyx_v_p_src->data;
14036 __pyx_v_dst.data = __pyx_t_5;
14045 __Pyx_TraceLine(743,0,__PYX_ERR(2, 743, __pyx_L1_error))
14046 __pyx_v_p_dst = (&__pyx_v_dst);
14055 __Pyx_TraceLine(744,0,__PYX_ERR(2, 744, __pyx_L1_error))
14056 __pyx_v_p_suboffset_dim = (&__pyx_v_suboffset_dim);
14065 __Pyx_TraceLine(748,0,__PYX_ERR(2, 748, __pyx_L1_error))
14067 if (likely(PyList_CheckExact(__pyx_v_indices)) || PyTuple_CheckExact(__pyx_v_indices)) {
14068 __pyx_t_3 = __pyx_v_indices; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0;
14071 __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_indices);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 748, __pyx_L1_error)
14072 __Pyx_GOTREF(__pyx_t_3);
14073 __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext;
if (unlikely(!__pyx_t_8)) __PYX_ERR(2, 748, __pyx_L1_error)
14076 if (likely(!__pyx_t_8)) {
14077 if (likely(PyList_CheckExact(__pyx_t_3))) {
14078 if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3))
break;
14079 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14080 __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
14082 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
14083 __Pyx_GOTREF(__pyx_t_9);
14086 if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3))
break;
14087 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
14088 __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++;
if (unlikely(0 < 0)) __PYX_ERR(2, 748, __pyx_L1_error)
14090 __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++;
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 748, __pyx_L1_error)
14091 __Pyx_GOTREF(__pyx_t_9);
14095 __pyx_t_9 = __pyx_t_8(__pyx_t_3);
14096 if (unlikely(!__pyx_t_9)) {
14097 PyObject* exc_type = PyErr_Occurred();
14099 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
14100 else __PYX_ERR(2, 748, __pyx_L1_error)
14104 __Pyx_GOTREF(__pyx_t_9);
14106 __Pyx_XDECREF_SET(__pyx_v_index, __pyx_t_9);
14108 __pyx_v_dim = __pyx_t_6;
14109 __pyx_t_6 = (__pyx_t_6 + 1);
14118 __Pyx_TraceLine(749,0,__PYX_ERR(2, 749, __pyx_L1_error))
14119 __pyx_t_2 = (PyIndex_Check(__pyx_v_index) != 0);
14129 __Pyx_TraceLine(753,0,__PYX_ERR(2, 753, __pyx_L1_error))
14130 __pyx_t_10 = __Pyx_PyIndex_AsSsize_t(__pyx_v_index);
if (unlikely((__pyx_t_10 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 753, __pyx_L1_error)
14139 __Pyx_TraceLine(750,0,__PYX_ERR(2, 750, __pyx_L1_error))
14140 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_t_10, 0, 0, 0, 0, 0, 0);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(2, 750, __pyx_L1_error)
14159 __Pyx_TraceLine(756,0,__PYX_ERR(2, 756, __pyx_L1_error))
14160 __pyx_t_2 = (__pyx_v_index == Py_None);
14161 __pyx_t_1 = (__pyx_t_2 != 0);
14171 __Pyx_TraceLine(757,0,__PYX_ERR(2, 757, __pyx_L1_error))
14172 (__pyx_v_p_dst->shape[__pyx_v_new_ndim]) = 1;
14181 __Pyx_TraceLine(758,0,__PYX_ERR(2, 758, __pyx_L1_error))
14182 (__pyx_v_p_dst->strides[__pyx_v_new_ndim]) = 0;
14191 __Pyx_TraceLine(759,0,__PYX_ERR(2, 759, __pyx_L1_error))
14192 (__pyx_v_p_dst->suboffsets[__pyx_v_new_ndim]) = -1L;
14201 __Pyx_TraceLine(760,0,__PYX_ERR(2, 760, __pyx_L1_error))
14202 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14221 __Pyx_TraceLine(762,0,__PYX_ERR(2, 762, __pyx_L1_error))
14223 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 762, __pyx_L1_error)
14224 __Pyx_GOTREF(__pyx_t_9);
14225 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 762, __pyx_L1_error)
14227 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14229 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 762, __pyx_L1_error)
14230 __pyx_t_10 = __pyx_t_12;
14231 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14232 goto __pyx_L7_bool_binop_done;
14235 __pyx_L7_bool_binop_done:;
14236 __pyx_v_start = __pyx_t_10;
14245 __Pyx_TraceLine(763,0,__PYX_ERR(2, 763, __pyx_L1_error))
14246 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 763, __pyx_L1_error)
14247 __Pyx_GOTREF(__pyx_t_9);
14248 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 763, __pyx_L1_error)
14250 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14252 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 763, __pyx_L1_error)
14253 __pyx_t_10 = __pyx_t_12;
14254 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14255 goto __pyx_L9_bool_binop_done;
14258 __pyx_L9_bool_binop_done:;
14259 __pyx_v_stop = __pyx_t_10;
14268 __Pyx_TraceLine(764,0,__PYX_ERR(2, 764, __pyx_L1_error))
14269 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 764, __pyx_L1_error)
14270 __Pyx_GOTREF(__pyx_t_9);
14271 __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9);
if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(2, 764, __pyx_L1_error)
14273 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14275 __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_t_9);
if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 764, __pyx_L1_error)
14276 __pyx_t_10 = __pyx_t_12;
14277 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14278 goto __pyx_L11_bool_binop_done;
14281 __pyx_L11_bool_binop_done:;
14282 __pyx_v_step = __pyx_t_10;
14291 __Pyx_TraceLine(766,0,__PYX_ERR(2, 766, __pyx_L1_error))
14292 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_start);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 766, __pyx_L1_error)
14293 __Pyx_GOTREF(__pyx_t_9);
14294 __pyx_t_1 = (__pyx_t_9 != Py_None);
14295 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14296 __pyx_v_have_start = __pyx_t_1;
14305 __Pyx_TraceLine(767,0,__PYX_ERR(2, 767, __pyx_L1_error))
14306 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_stop);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 767, __pyx_L1_error)
14307 __Pyx_GOTREF(__pyx_t_9);
14308 __pyx_t_1 = (__pyx_t_9 != Py_None);
14309 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14310 __pyx_v_have_stop = __pyx_t_1;
14319 __Pyx_TraceLine(768,0,__PYX_ERR(2, 768, __pyx_L1_error))
14320 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_index, __pyx_n_s_step);
if (unlikely(!__pyx_t_9)) __PYX_ERR(2, 768, __pyx_L1_error)
14321 __Pyx_GOTREF(__pyx_t_9);
14322 __pyx_t_1 = (__pyx_t_9 != Py_None);
14323 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
14324 __pyx_v_have_step = __pyx_t_1;
14333 __Pyx_TraceLine(770,0,__PYX_ERR(2, 770, __pyx_L1_error))
14334 __pyx_t_11 = __pyx_memoryview_slice_memviewslice(__pyx_v_p_dst, (__pyx_v_p_src->shape[__pyx_v_dim]), (__pyx_v_p_src->strides[__pyx_v_dim]), (__pyx_v_p_src->suboffsets[__pyx_v_dim]), __pyx_v_dim, __pyx_v_new_ndim, __pyx_v_p_suboffset_dim, __pyx_v_start, __pyx_v_stop, __pyx_v_step, __pyx_v_have_start, __pyx_v_have_stop, __pyx_v_have_step, 1);
if (unlikely(__pyx_t_11 == ((
int)-1))) __PYX_ERR(2, 770, __pyx_L1_error)
14343 __Pyx_TraceLine(776,0,__PYX_ERR(2, 776, __pyx_L1_error))
14344 __pyx_v_new_ndim = (__pyx_v_new_ndim + 1);
14355 __Pyx_TraceLine(748,0,__PYX_ERR(2, 748, __pyx_L1_error))
14357 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
14366 __Pyx_TraceLine(778,0,__PYX_ERR(2, 778, __pyx_L1_error))
14367 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
14368 __pyx_t_2 = (__pyx_t_1 != 0);
14378 __Pyx_TraceLine(779,0,__PYX_ERR(2, 779, __pyx_L1_error))
14379 __Pyx_XDECREF(((PyObject *)__pyx_r));
14388 __Pyx_TraceLine(780,0,__PYX_ERR(2, 780, __pyx_L1_error))
14389 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 780, __pyx_L1_error) }
14398 __Pyx_TraceLine(781,0,__PYX_ERR(2, 781, __pyx_L1_error))
14399 if (unlikely(!__pyx_v_memviewsliceobj)) { __Pyx_RaiseUnboundLocalError(
"memviewsliceobj"); __PYX_ERR(2, 781, __pyx_L1_error) }
14408 __Pyx_TraceLine(779,0,__PYX_ERR(2, 779, __pyx_L1_error))
14409 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, __pyx_v_memviewsliceobj->to_object_func, __pyx_v_memviewsliceobj->to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 779, __pyx_L1_error)
14410 __Pyx_GOTREF(__pyx_t_3);
14411 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 779, __pyx_L1_error)
14412 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14432 __Pyx_TraceLine(784,0,__PYX_ERR(2, 784, __pyx_L1_error))
14434 __Pyx_XDECREF(((PyObject *)__pyx_r));
14443 __Pyx_TraceLine(785,0,__PYX_ERR(2, 785, __pyx_L1_error))
14444 __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_dst, __pyx_v_new_ndim, NULL, NULL, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 784, __pyx_L1_error)
14445 __Pyx_GOTREF(__pyx_t_3);
14454 __Pyx_TraceLine(784,0,__PYX_ERR(2, 784, __pyx_L1_error))
14455 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_memoryview_type))))) __PYX_ERR(2, 784, __pyx_L1_error)
14456 __pyx_r = ((
struct __pyx_memoryview_obj *)__pyx_t_3);
14471 __Pyx_XDECREF(__pyx_t_3);
14472 __Pyx_XDECREF(__pyx_t_9);
14473 __Pyx_AddTraceback(
"View.MemoryView.memview_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
14476 __Pyx_XDECREF((PyObject *)__pyx_v_memviewsliceobj);
14477 __Pyx_XDECREF(__pyx_v_index);
14478 __Pyx_XGIVEREF((PyObject *)__pyx_r);
14479 __Pyx_TraceReturn(__pyx_r, 0);
14480 __Pyx_RefNannyFinishContext();
14492 static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, Py_ssize_t __pyx_v_shape, Py_ssize_t __pyx_v_stride, Py_ssize_t __pyx_v_suboffset,
int __pyx_v_dim,
int __pyx_v_new_ndim,
int *__pyx_v_suboffset_dim, Py_ssize_t __pyx_v_start, Py_ssize_t __pyx_v_stop, Py_ssize_t __pyx_v_step,
int __pyx_v_have_start,
int __pyx_v_have_stop,
int __pyx_v_have_step,
int __pyx_v_is_slice) {
14493 Py_ssize_t __pyx_v_new_shape;
14494 int __pyx_v_negative_step;
14496 __Pyx_TraceDeclarations
14500 int __pyx_lineno = 0;
14501 const char *__pyx_filename = NULL;
14502 int __pyx_clineno = 0;
14503 __Pyx_TraceCall(
"slice_memviewslice", __pyx_f[2], 809, 1, __PYX_ERR(2, 809, __pyx_L1_error));
14512 __Pyx_TraceLine(829,1,__PYX_ERR(2, 829, __pyx_L1_error))
14513 __pyx_t_1 = ((!(__pyx_v_is_slice != 0)) != 0);
14523 __Pyx_TraceLine(831,1,__PYX_ERR(2, 831, __pyx_L1_error))
14524 __pyx_t_1 = ((__pyx_v_start < 0) != 0);
14534 __Pyx_TraceLine(832,1,__PYX_ERR(2, 832, __pyx_L1_error))
14535 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14553 __Pyx_TraceLine(833,1,__PYX_ERR(2, 833, __pyx_L1_error))
14554 __pyx_t_1 = (0 <= __pyx_v_start);
14556 __pyx_t_1 = (__pyx_v_start < __pyx_v_shape);
14558 __pyx_t_2 = ((!(__pyx_t_1 != 0)) != 0);
14568 __Pyx_TraceLine(834,1,__PYX_ERR(2, 834, __pyx_L1_error))
14569 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"Index out of bounds (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 834, __pyx_L1_error)
14597 __Pyx_TraceLine(837,1,__PYX_ERR(2, 837, __pyx_L1_error))
14599 __pyx_t_1 = ((__pyx_v_have_step != 0) != 0);
14602 __pyx_t_2 = __pyx_t_1;
14603 goto __pyx_L6_bool_binop_done;
14605 __pyx_t_1 = ((__pyx_v_step < 0) != 0);
14606 __pyx_t_2 = __pyx_t_1;
14607 __pyx_L6_bool_binop_done:;
14608 __pyx_v_negative_step = __pyx_t_2;
14617 __Pyx_TraceLine(839,1,__PYX_ERR(2, 839, __pyx_L1_error))
14618 __pyx_t_1 = (__pyx_v_have_step != 0);
14621 __pyx_t_2 = __pyx_t_1;
14622 goto __pyx_L9_bool_binop_done;
14624 __pyx_t_1 = ((__pyx_v_step == 0) != 0);
14625 __pyx_t_2 = __pyx_t_1;
14626 __pyx_L9_bool_binop_done:;
14636 __Pyx_TraceLine(840,1,__PYX_ERR(2, 840, __pyx_L1_error))
14637 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Step may not be zero (axis %d)"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 840, __pyx_L1_error)
14655 __Pyx_TraceLine(843,1,__PYX_ERR(2, 843, __pyx_L1_error))
14656 __pyx_t_2 = (__pyx_v_have_start != 0);
14666 __Pyx_TraceLine(844,1,__PYX_ERR(2, 844, __pyx_L1_error))
14667 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14677 __Pyx_TraceLine(845,1,__PYX_ERR(2, 845, __pyx_L1_error))
14678 __pyx_v_start = (__pyx_v_start + __pyx_v_shape);
14687 __Pyx_TraceLine(846,1,__PYX_ERR(2, 846, __pyx_L1_error))
14688 __pyx_t_2 = ((__pyx_v_start < 0) != 0);
14698 __Pyx_TraceLine(847,1,__PYX_ERR(2, 847, __pyx_L1_error))
14727 __Pyx_TraceLine(848,1,__PYX_ERR(2, 848, __pyx_L1_error))
14728 __pyx_t_2 = ((__pyx_v_start >= __pyx_v_shape) != 0);
14738 __Pyx_TraceLine(849,1,__PYX_ERR(2, 849, __pyx_L1_error))
14739 __pyx_t_2 = (__pyx_v_negative_step != 0);
14749 __Pyx_TraceLine(850,1,__PYX_ERR(2, 850, __pyx_L1_error))
14750 __pyx_v_start = (__pyx_v_shape - 1);
14769 __Pyx_TraceLine(852,1,__PYX_ERR(2, 852, __pyx_L1_error))
14771 __pyx_v_start = __pyx_v_shape;
14802 __Pyx_TraceLine(854,1,__PYX_ERR(2, 854, __pyx_L1_error))
14804 __pyx_t_2 = (__pyx_v_negative_step != 0);
14814 __Pyx_TraceLine(855,1,__PYX_ERR(2, 855, __pyx_L1_error))
14815 __pyx_v_start = (__pyx_v_shape - 1);
14834 __Pyx_TraceLine(857,1,__PYX_ERR(2, 857, __pyx_L1_error))
14849 __Pyx_TraceLine(859,1,__PYX_ERR(2, 859, __pyx_L1_error))
14850 __pyx_t_2 = (__pyx_v_have_stop != 0);
14860 __Pyx_TraceLine(860,1,__PYX_ERR(2, 860, __pyx_L1_error))
14861 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14871 __Pyx_TraceLine(861,1,__PYX_ERR(2, 861, __pyx_L1_error))
14872 __pyx_v_stop = (__pyx_v_stop + __pyx_v_shape);
14881 __Pyx_TraceLine(862,1,__PYX_ERR(2, 862, __pyx_L1_error))
14882 __pyx_t_2 = ((__pyx_v_stop < 0) != 0);
14892 __Pyx_TraceLine(863,1,__PYX_ERR(2, 863, __pyx_L1_error))
14921 __Pyx_TraceLine(864,1,__PYX_ERR(2, 864, __pyx_L1_error))
14922 __pyx_t_2 = ((__pyx_v_stop > __pyx_v_shape) != 0);
14932 __Pyx_TraceLine(865,1,__PYX_ERR(2, 865, __pyx_L1_error))
14933 __pyx_v_stop = __pyx_v_shape;
14962 __Pyx_TraceLine(867,1,__PYX_ERR(2, 867, __pyx_L1_error))
14964 __pyx_t_2 = (__pyx_v_negative_step != 0);
14974 __Pyx_TraceLine(868,1,__PYX_ERR(2, 868, __pyx_L1_error))
14975 __pyx_v_stop = -1L;
14994 __Pyx_TraceLine(870,1,__PYX_ERR(2, 870, __pyx_L1_error))
14996 __pyx_v_stop = __pyx_v_shape;
15009 __Pyx_TraceLine(872,1,__PYX_ERR(2, 872, __pyx_L1_error))
15010 __pyx_t_2 = ((!(__pyx_v_have_step != 0)) != 0);
15020 __Pyx_TraceLine(873,1,__PYX_ERR(2, 873, __pyx_L1_error))
15039 __pyx_v_new_shape = ((__pyx_v_stop - __pyx_v_start) / __pyx_v_step);
15048 __pyx_t_2 = (((__pyx_v_stop - __pyx_v_start) - (__pyx_v_step * __pyx_v_new_shape)) != 0);
15058 __pyx_v_new_shape = (__pyx_v_new_shape + 1);
15076 __Pyx_TraceLine(882,1,__PYX_ERR(2, 882, __pyx_L1_error))
15077 __pyx_t_2 = ((__pyx_v_new_shape < 0) != 0);
15087 __Pyx_TraceLine(883,1,__PYX_ERR(2, 883, __pyx_L1_error))
15088 __pyx_v_new_shape = 0;
15106 __Pyx_TraceLine(886,1,__PYX_ERR(2, 886, __pyx_L1_error))
15107 (__pyx_v_dst->strides[__pyx_v_new_ndim]) = (__pyx_v_stride * __pyx_v_step);
15116 __Pyx_TraceLine(887,1,__PYX_ERR(2, 887, __pyx_L1_error))
15117 (__pyx_v_dst->shape[__pyx_v_new_ndim]) = __pyx_v_new_shape;
15126 __Pyx_TraceLine(888,1,__PYX_ERR(2, 888, __pyx_L1_error))
15127 (__pyx_v_dst->suboffsets[__pyx_v_new_ndim]) = __pyx_v_suboffset;
15138 __Pyx_TraceLine(891,1,__PYX_ERR(2, 891, __pyx_L1_error))
15139 __pyx_t_2 = (((__pyx_v_suboffset_dim[0]) < 0) != 0);
15149 __Pyx_TraceLine(892,1,__PYX_ERR(2, 892, __pyx_L1_error))
15150 __pyx_v_dst->data = (__pyx_v_dst->data + (__pyx_v_start * __pyx_v_stride));
15169 __Pyx_TraceLine(894,1,__PYX_ERR(2, 894, __pyx_L1_error))
15171 __pyx_t_3 = (__pyx_v_suboffset_dim[0]);
15172 (__pyx_v_dst->suboffsets[__pyx_t_3]) = ((__pyx_v_dst->suboffsets[__pyx_t_3]) + (__pyx_v_start * __pyx_v_stride));
15183 __Pyx_TraceLine(896,1,__PYX_ERR(2, 896, __pyx_L1_error))
15184 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15194 __Pyx_TraceLine(897,1,__PYX_ERR(2, 897, __pyx_L1_error))
15195 __pyx_t_2 = ((!(__pyx_v_is_slice != 0)) != 0);
15205 __Pyx_TraceLine(898,1,__PYX_ERR(2, 898, __pyx_L1_error))
15206 __pyx_t_2 = ((__pyx_v_new_ndim == 0) != 0);
15216 __Pyx_TraceLine(899,1,__PYX_ERR(2, 899, __pyx_L1_error))
15217 __pyx_v_dst->data = ((((
char **)__pyx_v_dst->data)[0]) + __pyx_v_suboffset);
15236 __Pyx_TraceLine(901,1,__PYX_ERR(2, 901, __pyx_L1_error))
15246 __Pyx_TraceLine(902,1,__PYX_ERR(2, 902, __pyx_L1_error))
15247 __pyx_t_3 = __pyx_memoryview_err_dim(__pyx_builtin_IndexError, ((
char *)
"All dimensions preceding dimension %d must be indexed and not sliced"), __pyx_v_dim);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 901, __pyx_L1_error)
15268 __Pyx_TraceLine(904,1,__PYX_ERR(2, 904, __pyx_L1_error))
15270 (__pyx_v_suboffset_dim[0]) = __pyx_v_new_ndim;
15290 __Pyx_TraceLine(906,1,__PYX_ERR(2, 906, __pyx_L1_error))
15306 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15308 __Pyx_AddTraceback(
"View.MemoryView.slice_memviewslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15310 __Pyx_PyGILState_Release(__pyx_gilstate_save);
15315 __Pyx_TraceReturn(Py_None, 1);
15327 static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view,
char *__pyx_v_bufp, Py_ssize_t __pyx_v_index, Py_ssize_t __pyx_v_dim) {
15328 Py_ssize_t __pyx_v_shape;
15329 Py_ssize_t __pyx_v_stride;
15330 Py_ssize_t __pyx_v_suboffset;
15331 Py_ssize_t __pyx_v_itemsize;
15332 char *__pyx_v_resultp;
15334 __Pyx_TraceDeclarations
15335 __Pyx_RefNannyDeclarations
15336 Py_ssize_t __pyx_t_1;
15338 PyObject *__pyx_t_3 = NULL;
15339 PyObject *__pyx_t_4 = NULL;
15340 int __pyx_lineno = 0;
15341 const char *__pyx_filename = NULL;
15342 int __pyx_clineno = 0;
15343 __Pyx_RefNannySetupContext(
"pybuffer_index", 0);
15344 __Pyx_TraceCall(
"pybuffer_index", __pyx_f[2], 912, 0, __PYX_ERR(2, 912, __pyx_L1_error));
15353 __Pyx_TraceLine(914,0,__PYX_ERR(2, 914, __pyx_L1_error))
15354 __pyx_v_suboffset = -1L;
15363 __Pyx_TraceLine(915,0,__PYX_ERR(2, 915, __pyx_L1_error))
15364 __pyx_t_1 = __pyx_v_view->itemsize;
15365 __pyx_v_itemsize = __pyx_t_1;
15374 __Pyx_TraceLine(918,0,__PYX_ERR(2, 918, __pyx_L1_error))
15375 __pyx_t_2 = ((__pyx_v_view->ndim == 0) != 0);
15385 __Pyx_TraceLine(919,0,__PYX_ERR(2, 919, __pyx_L1_error))
15386 if (unlikely(__pyx_v_itemsize == 0)) {
15387 PyErr_SetString(PyExc_ZeroDivisionError,
"integer division or modulo by zero");
15388 __PYX_ERR(2, 919, __pyx_L1_error)
15390 else if (
sizeof(Py_ssize_t) ==
sizeof(
long) && (!(((Py_ssize_t)-1) > 0)) && unlikely(__pyx_v_itemsize == (Py_ssize_t)-1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_view->len))) {
15391 PyErr_SetString(PyExc_OverflowError,
"value too large to perform division");
15392 __PYX_ERR(2, 919, __pyx_L1_error)
15394 __pyx_v_shape = (__pyx_v_view->len / __pyx_v_itemsize);
15403 __Pyx_TraceLine(920,0,__PYX_ERR(2, 920, __pyx_L1_error))
15404 __pyx_v_stride = __pyx_v_itemsize;
15423 __Pyx_TraceLine(922,0,__PYX_ERR(2, 922, __pyx_L1_error))
15425 __pyx_v_shape = (__pyx_v_view->shape[__pyx_v_dim]);
15434 __Pyx_TraceLine(923,0,__PYX_ERR(2, 923, __pyx_L1_error))
15435 __pyx_v_stride = (__pyx_v_view->strides[__pyx_v_dim]);
15444 __Pyx_TraceLine(924,0,__PYX_ERR(2, 924, __pyx_L1_error))
15445 __pyx_t_2 = ((__pyx_v_view->suboffsets != NULL) != 0);
15455 __Pyx_TraceLine(925,0,__PYX_ERR(2, 925, __pyx_L1_error))
15456 __pyx_v_suboffset = (__pyx_v_view->suboffsets[__pyx_v_dim]);
15476 __Pyx_TraceLine(927,0,__PYX_ERR(2, 927, __pyx_L1_error))
15477 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15487 __Pyx_TraceLine(928,0,__PYX_ERR(2, 928, __pyx_L1_error))
15488 __pyx_v_index = (__pyx_v_index + (__pyx_v_view->shape[__pyx_v_dim]));
15497 __Pyx_TraceLine(929,0,__PYX_ERR(2, 929, __pyx_L1_error))
15498 __pyx_t_2 = ((__pyx_v_index < 0) != 0);
15499 if (unlikely(__pyx_t_2)) {
15508 __Pyx_TraceLine(930,0,__PYX_ERR(2, 930, __pyx_L1_error))
15509 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
15510 __Pyx_GOTREF(__pyx_t_3);
15511 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 930, __pyx_L1_error)
15512 __Pyx_GOTREF(__pyx_t_4);
15513 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15514 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 930, __pyx_L1_error)
15515 __Pyx_GOTREF(__pyx_t_3);
15516 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15517 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15518 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15519 __PYX_ERR(2, 930, __pyx_L1_error)
15546 __Pyx_TraceLine(932,0,__PYX_ERR(2, 932, __pyx_L1_error))
15547 __pyx_t_2 = ((__pyx_v_index >= __pyx_v_shape) != 0);
15548 if (unlikely(__pyx_t_2)) {
15557 __Pyx_TraceLine(933,0,__PYX_ERR(2, 933, __pyx_L1_error))
15558 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
15559 __Pyx_GOTREF(__pyx_t_3);
15560 __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 933, __pyx_L1_error)
15561 __Pyx_GOTREF(__pyx_t_4);
15562 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15563 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_IndexError, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 933, __pyx_L1_error)
15564 __Pyx_GOTREF(__pyx_t_3);
15565 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
15566 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
15567 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
15568 __PYX_ERR(2, 933, __pyx_L1_error)
15586 __Pyx_TraceLine(935,0,__PYX_ERR(2, 935, __pyx_L1_error))
15587 __pyx_v_resultp = (__pyx_v_bufp + (__pyx_v_index * __pyx_v_stride));
15596 __Pyx_TraceLine(936,0,__PYX_ERR(2, 936, __pyx_L1_error))
15597 __pyx_t_2 = ((__pyx_v_suboffset >= 0) != 0);
15607 __Pyx_TraceLine(937,0,__PYX_ERR(2, 937, __pyx_L1_error))
15608 __pyx_v_resultp = ((((
char **)__pyx_v_resultp)[0]) + __pyx_v_suboffset);
15626 __Pyx_TraceLine(939,0,__PYX_ERR(2, 939, __pyx_L1_error))
15627 __pyx_r = __pyx_v_resultp;
15640 __Pyx_XDECREF(__pyx_t_3);
15641 __Pyx_XDECREF(__pyx_t_4);
15642 __Pyx_AddTraceback(
"View.MemoryView.pybuffer_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
15645 __Pyx_TraceReturn(Py_None, 0);
15646 __Pyx_RefNannyFinishContext();
15658 static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) {
15660 Py_ssize_t *__pyx_v_shape;
15661 Py_ssize_t *__pyx_v_strides;
15665 __Pyx_TraceDeclarations
15667 Py_ssize_t *__pyx_t_2;
15670 Py_ssize_t __pyx_t_5;
15671 Py_ssize_t __pyx_t_6;
15675 int __pyx_lineno = 0;
15676 const char *__pyx_filename = NULL;
15677 int __pyx_clineno = 0;
15678 __Pyx_TraceCall(
"transpose_memslice", __pyx_f[2], 945, 1, __PYX_ERR(2, 945, __pyx_L1_error));
15687 __Pyx_TraceLine(946,1,__PYX_ERR(2, 946, __pyx_L1_error))
15688 __pyx_t_1 = __pyx_v_memslice->memview->view.ndim;
15689 __pyx_v_ndim = __pyx_t_1;
15698 __Pyx_TraceLine(948,1,__PYX_ERR(2, 948, __pyx_L1_error))
15699 __pyx_t_2 = __pyx_v_memslice->shape;
15700 __pyx_v_shape = __pyx_t_2;
15709 __Pyx_TraceLine(949,1,__PYX_ERR(2, 949, __pyx_L1_error))
15710 __pyx_t_2 = __pyx_v_memslice->strides;
15711 __pyx_v_strides = __pyx_t_2;
15720 __Pyx_TraceLine(953,1,__PYX_ERR(2, 953, __pyx_L1_error))
15721 __pyx_t_3 = (__pyx_v_ndim / 2);
15722 __pyx_t_4 = __pyx_t_3;
15723 for (__pyx_t_1 = 0; __pyx_t_1 < __pyx_t_4; __pyx_t_1+=1) {
15724 __pyx_v_i = __pyx_t_1;
15733 __Pyx_TraceLine(954,1,__PYX_ERR(2, 954, __pyx_L1_error))
15734 __pyx_v_j = ((__pyx_v_ndim - 1) - __pyx_v_i);
15743 __Pyx_TraceLine(955,1,__PYX_ERR(2, 955, __pyx_L1_error))
15744 __pyx_t_5 = (__pyx_v_strides[__pyx_v_j]);
15745 __pyx_t_6 = (__pyx_v_strides[__pyx_v_i]);
15746 (__pyx_v_strides[__pyx_v_i]) = __pyx_t_5;
15747 (__pyx_v_strides[__pyx_v_j]) = __pyx_t_6;
15756 __Pyx_TraceLine(956,1,__PYX_ERR(2, 956, __pyx_L1_error))
15757 __pyx_t_6 = (__pyx_v_shape[__pyx_v_j]);
15758 __pyx_t_5 = (__pyx_v_shape[__pyx_v_i]);
15759 (__pyx_v_shape[__pyx_v_i]) = __pyx_t_6;
15760 (__pyx_v_shape[__pyx_v_j]) = __pyx_t_5;
15769 __Pyx_TraceLine(958,1,__PYX_ERR(2, 958, __pyx_L1_error))
15770 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_i]) >= 0) != 0);
15773 __pyx_t_7 = __pyx_t_8;
15774 goto __pyx_L6_bool_binop_done;
15776 __pyx_t_8 = (((__pyx_v_memslice->suboffsets[__pyx_v_j]) >= 0) != 0);
15777 __pyx_t_7 = __pyx_t_8;
15778 __pyx_L6_bool_binop_done:;
15788 __Pyx_TraceLine(959,1,__PYX_ERR(2, 959, __pyx_L1_error))
15789 __pyx_t_9 = __pyx_memoryview_err(__pyx_builtin_ValueError, ((
char *)
"Cannot transpose memoryview with indirect dimensions"));
if (unlikely(__pyx_t_9 == ((
int)-1))) __PYX_ERR(2, 959, __pyx_L1_error)
15808 __Pyx_TraceLine(961,1,__PYX_ERR(2, 961, __pyx_L1_error))
15824 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
15826 __Pyx_AddTraceback(
"View.MemoryView.transpose_memslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
15828 __Pyx_PyGILState_Release(__pyx_gilstate_save);
15833 __Pyx_TraceReturn(Py_None, 1);
15846 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self);
15847 static void __pyx_memoryviewslice___dealloc__(PyObject *__pyx_v_self) {
15848 __Pyx_RefNannyDeclarations
15849 __Pyx_RefNannySetupContext(
"__dealloc__ (wrapper)", 0);
15850 __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
15853 __Pyx_RefNannyFinishContext();
15856 static void __pyx_memoryviewslice___pyx_pf_15View_dot_MemoryView_16_memoryviewslice___dealloc__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
15857 __Pyx_TraceDeclarations
15858 __Pyx_RefNannyDeclarations
15859 int __pyx_lineno = 0;
15860 const char *__pyx_filename = NULL;
15861 int __pyx_clineno = 0;
15862 __Pyx_RefNannySetupContext(
"__dealloc__", 0);
15863 __Pyx_TraceCall(
"__dealloc__", __pyx_f[2], 978, 0, __PYX_ERR(2, 978, __pyx_L1_error));
15872 __Pyx_TraceLine(979,0,__PYX_ERR(2, 979, __pyx_L1_error))
15873 __PYX_XDEC_MEMVIEW((&__pyx_v_self->from_slice), 1);
15886 __Pyx_WriteUnraisable(
"View.MemoryView._memoryviewslice.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
15888 __Pyx_TraceReturn(Py_None, 0);
15889 __Pyx_RefNannyFinishContext();
15900 static PyObject *__pyx_memoryviewslice_convert_item_to_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp) {
15901 PyObject *__pyx_r = NULL;
15902 __Pyx_TraceDeclarations
15903 __Pyx_RefNannyDeclarations
15905 PyObject *__pyx_t_2 = NULL;
15906 int __pyx_lineno = 0;
15907 const char *__pyx_filename = NULL;
15908 int __pyx_clineno = 0;
15909 __Pyx_RefNannySetupContext(
"convert_item_to_object", 0);
15910 __Pyx_TraceCall(
"convert_item_to_object", __pyx_f[2], 981, 0, __PYX_ERR(2, 981, __pyx_L1_error));
15919 __Pyx_TraceLine(982,0,__PYX_ERR(2, 982, __pyx_L1_error))
15920 __pyx_t_1 = ((__pyx_v_self->to_object_func != NULL) != 0);
15930 __Pyx_TraceLine(983,0,__PYX_ERR(2, 983, __pyx_L1_error))
15931 __Pyx_XDECREF(__pyx_r);
15932 __pyx_t_2 = __pyx_v_self->to_object_func(__pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 983, __pyx_L1_error)
15933 __Pyx_GOTREF(__pyx_t_2);
15934 __pyx_r = __pyx_t_2;
15954 __Pyx_TraceLine(985,0,__PYX_ERR(2, 985, __pyx_L1_error))
15956 __Pyx_XDECREF(__pyx_r);
15957 __pyx_t_2 = __pyx_memoryview_convert_item_to_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 985, __pyx_L1_error)
15958 __Pyx_GOTREF(__pyx_t_2);
15959 __pyx_r = __pyx_t_2;
15974 __Pyx_XDECREF(__pyx_t_2);
15975 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.convert_item_to_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
15978 __Pyx_XGIVEREF(__pyx_r);
15979 __Pyx_TraceReturn(__pyx_r, 0);
15980 __Pyx_RefNannyFinishContext();
15992 static PyObject *__pyx_memoryviewslice_assign_item_from_object(
struct __pyx_memoryviewslice_obj *__pyx_v_self,
char *__pyx_v_itemp, PyObject *__pyx_v_value) {
15993 PyObject *__pyx_r = NULL;
15994 __Pyx_TraceDeclarations
15995 __Pyx_RefNannyDeclarations
15998 PyObject *__pyx_t_3 = NULL;
15999 int __pyx_lineno = 0;
16000 const char *__pyx_filename = NULL;
16001 int __pyx_clineno = 0;
16002 __Pyx_RefNannySetupContext(
"assign_item_from_object", 0);
16003 __Pyx_TraceCall(
"assign_item_from_object", __pyx_f[2], 987, 0, __PYX_ERR(2, 987, __pyx_L1_error));
16012 __Pyx_TraceLine(988,0,__PYX_ERR(2, 988, __pyx_L1_error))
16013 __pyx_t_1 = ((__pyx_v_self->to_dtype_func != NULL) != 0);
16023 __Pyx_TraceLine(989,0,__PYX_ERR(2, 989, __pyx_L1_error))
16024 __pyx_t_2 = __pyx_v_self->to_dtype_func(__pyx_v_itemp, __pyx_v_value);
if (unlikely(__pyx_t_2 == ((
int)0))) __PYX_ERR(2, 989, __pyx_L1_error)
16043 __Pyx_TraceLine(991,0,__PYX_ERR(2, 991, __pyx_L1_error))
16045 __pyx_t_3 = __pyx_memoryview_assign_item_from_object(((
struct __pyx_memoryview_obj *)__pyx_v_self), __pyx_v_itemp, __pyx_v_value);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 991, __pyx_L1_error)
16046 __Pyx_GOTREF(__pyx_t_3);
16047 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16060 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16063 __Pyx_XDECREF(__pyx_t_3);
16064 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.assign_item_from_object", __pyx_clineno, __pyx_lineno, __pyx_filename);
16067 __Pyx_XGIVEREF(__pyx_r);
16068 __Pyx_TraceReturn(__pyx_r, 0);
16069 __Pyx_RefNannyFinishContext();
16082 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self);
16083 static PyObject *__pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(PyObject *__pyx_v_self) {
16084 PyObject *__pyx_r = 0;
16085 __Pyx_RefNannyDeclarations
16086 __Pyx_RefNannySetupContext(
"__get__ (wrapper)", 0);
16087 __pyx_r = __pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16090 __Pyx_RefNannyFinishContext();
16094 static PyObject *__pyx_pf_15View_dot_MemoryView_16_memoryviewslice_4base___get__(
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16095 PyObject *__pyx_r = NULL;
16096 __Pyx_TraceDeclarations
16097 __Pyx_RefNannyDeclarations
16098 int __pyx_lineno = 0;
16099 const char *__pyx_filename = NULL;
16100 int __pyx_clineno = 0;
16101 __Pyx_RefNannySetupContext(
"__get__", 0);
16102 __Pyx_TraceCall(
"__get__", __pyx_f[2], 994, 0, __PYX_ERR(2, 994, __pyx_L1_error));
16111 __Pyx_TraceLine(995,0,__PYX_ERR(2, 995, __pyx_L1_error))
16112 __Pyx_XDECREF(__pyx_r);
16113 __Pyx_INCREF(__pyx_v_self->from_object);
16114 __pyx_r = __pyx_v_self->from_object;
16127 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16130 __Pyx_XGIVEREF(__pyx_r);
16131 __Pyx_TraceReturn(__pyx_r, 0);
16132 __Pyx_RefNannyFinishContext();
16143 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused);
16144 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_1__reduce_cython__ = {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0};
16145 static PyObject *__pyx_pw___pyx_memoryviewslice_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
16146 PyObject *__pyx_r = 0;
16147 __Pyx_RefNannyDeclarations
16148 __Pyx_RefNannySetupContext(
"__reduce_cython__ (wrapper)", 0);
16149 __pyx_r = __pyx_pf___pyx_memoryviewslice___reduce_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self));
16152 __Pyx_RefNannyFinishContext();
16156 static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self) {
16157 PyObject *__pyx_r = NULL;
16158 __Pyx_TraceDeclarations
16159 __Pyx_RefNannyDeclarations
16160 PyObject *__pyx_t_1 = NULL;
16161 int __pyx_lineno = 0;
16162 const char *__pyx_filename = NULL;
16163 int __pyx_clineno = 0;
16164 __Pyx_RefNannySetupContext(
"__reduce_cython__", 0);
16165 __Pyx_TraceCall(
"__reduce_cython__", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
16173 __Pyx_TraceLine(2,0,__PYX_ERR(2, 2, __pyx_L1_error))
16174 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__19, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 2, __pyx_L1_error)
16175 __Pyx_GOTREF(__pyx_t_1);
16176 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16177 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16178 __PYX_ERR(2, 2, __pyx_L1_error)
16188 __Pyx_XDECREF(__pyx_t_1);
16189 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16191 __Pyx_XGIVEREF(__pyx_r);
16192 __Pyx_TraceReturn(__pyx_r, 0);
16193 __Pyx_RefNannyFinishContext();
16205 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state);
16206 static PyMethodDef __pyx_mdef___pyx_memoryviewslice_3__setstate_cython__ = {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0};
16207 static PyObject *__pyx_pw___pyx_memoryviewslice_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
16208 PyObject *__pyx_r = 0;
16209 __Pyx_RefNannyDeclarations
16210 __Pyx_RefNannySetupContext(
"__setstate_cython__ (wrapper)", 0);
16211 __pyx_r = __pyx_pf___pyx_memoryviewslice_2__setstate_cython__(((
struct __pyx_memoryviewslice_obj *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
16214 __Pyx_RefNannyFinishContext();
16218 static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUSED
struct __pyx_memoryviewslice_obj *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
16219 PyObject *__pyx_r = NULL;
16220 __Pyx_TraceDeclarations
16221 __Pyx_RefNannyDeclarations
16222 PyObject *__pyx_t_1 = NULL;
16223 int __pyx_lineno = 0;
16224 const char *__pyx_filename = NULL;
16225 int __pyx_clineno = 0;
16226 __Pyx_RefNannySetupContext(
"__setstate_cython__", 0);
16227 __Pyx_TraceCall(
"__setstate_cython__", __pyx_f[2], 3, 0, __PYX_ERR(2, 3, __pyx_L1_error));
16234 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
16235 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__20, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
16236 __Pyx_GOTREF(__pyx_t_1);
16237 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
16238 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
16239 __PYX_ERR(2, 4, __pyx_L1_error)
16250 __Pyx_XDECREF(__pyx_t_1);
16251 __Pyx_AddTraceback(
"View.MemoryView._memoryviewslice.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
16253 __Pyx_XGIVEREF(__pyx_r);
16254 __Pyx_TraceReturn(__pyx_r, 0);
16255 __Pyx_RefNannyFinishContext();
16267 static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewslice,
int __pyx_v_ndim, PyObject *(*__pyx_v_to_object_func)(
char *),
int (*__pyx_v_to_dtype_func)(
char *, PyObject *),
int __pyx_v_dtype_is_object) {
16268 struct __pyx_memoryviewslice_obj *__pyx_v_result = 0;
16269 Py_ssize_t __pyx_v_suboffset;
16270 PyObject *__pyx_v_length = NULL;
16271 PyObject *__pyx_r = NULL;
16272 __Pyx_TraceDeclarations
16273 __Pyx_RefNannyDeclarations
16275 PyObject *__pyx_t_2 = NULL;
16276 PyObject *__pyx_t_3 = NULL;
16277 __Pyx_TypeInfo *__pyx_t_4;
16278 Py_buffer __pyx_t_5;
16279 Py_ssize_t *__pyx_t_6;
16280 Py_ssize_t *__pyx_t_7;
16281 Py_ssize_t *__pyx_t_8;
16282 Py_ssize_t __pyx_t_9;
16283 int __pyx_lineno = 0;
16284 const char *__pyx_filename = NULL;
16285 int __pyx_clineno = 0;
16286 __Pyx_RefNannySetupContext(
"memoryview_fromslice", 0);
16287 __Pyx_TraceCall(
"memoryview_fromslice", __pyx_f[2], 1001, 0, __PYX_ERR(2, 1001, __pyx_L1_error));
16296 __Pyx_TraceLine(1009,0,__PYX_ERR(2, 1009, __pyx_L1_error))
16297 __pyx_t_1 = ((((PyObject *)__pyx_v_memviewslice.memview) == Py_None) != 0);
16307 __Pyx_TraceLine(1010,0,__PYX_ERR(2, 1010, __pyx_L1_error))
16308 __Pyx_XDECREF(__pyx_r);
16309 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
16328 __Pyx_TraceLine(1015,0,__PYX_ERR(2, 1015, __pyx_L1_error))
16329 __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_dtype_is_object);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
16330 __Pyx_GOTREF(__pyx_t_2);
16331 __pyx_t_3 = PyTuple_New(3);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1015, __pyx_L1_error)
16332 __Pyx_GOTREF(__pyx_t_3);
16333 __Pyx_INCREF(Py_None);
16334 __Pyx_GIVEREF(Py_None);
16335 PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
16336 __Pyx_INCREF(__pyx_int_0);
16337 __Pyx_GIVEREF(__pyx_int_0);
16338 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0);
16339 __Pyx_GIVEREF(__pyx_t_2);
16340 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2);
16342 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_memoryviewslice_type), __pyx_t_3, NULL);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1015, __pyx_L1_error)
16343 __Pyx_GOTREF(__pyx_t_2);
16344 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16345 __pyx_v_result = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_2);
16355 __Pyx_TraceLine(1017,0,__PYX_ERR(2, 1017, __pyx_L1_error))
16356 __pyx_v_result->from_slice = __pyx_v_memviewslice;
16365 __Pyx_TraceLine(1018,0,__PYX_ERR(2, 1018, __pyx_L1_error))
16366 __PYX_INC_MEMVIEW((&__pyx_v_memviewslice), 1);
16375 __Pyx_TraceLine(1020,0,__PYX_ERR(2, 1020, __pyx_L1_error))
16376 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_memviewslice.memview), __pyx_n_s_base);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1020, __pyx_L1_error)
16377 __Pyx_GOTREF(__pyx_t_2);
16378 __Pyx_GIVEREF(__pyx_t_2);
16379 __Pyx_GOTREF(__pyx_v_result->from_object);
16380 __Pyx_DECREF(__pyx_v_result->from_object);
16381 __pyx_v_result->from_object = __pyx_t_2;
16391 __Pyx_TraceLine(1021,0,__PYX_ERR(2, 1021, __pyx_L1_error))
16392 __pyx_t_4 = __pyx_v_memviewslice.memview->typeinfo;
16393 __pyx_v_result->__pyx_base.typeinfo = __pyx_t_4;
16402 __Pyx_TraceLine(1023,0,__PYX_ERR(2, 1023, __pyx_L1_error))
16403 __pyx_t_5 = __pyx_v_memviewslice.memview->view;
16404 __pyx_v_result->__pyx_base.view = __pyx_t_5;
16413 __Pyx_TraceLine(1024,0,__PYX_ERR(2, 1024, __pyx_L1_error))
16414 __pyx_v_result->__pyx_base.view.buf = ((
void *)__pyx_v_memviewslice.data);
16423 __Pyx_TraceLine(1025,0,__PYX_ERR(2, 1025, __pyx_L1_error))
16424 __pyx_v_result->__pyx_base.view.ndim = __pyx_v_ndim;
16433 __Pyx_TraceLine(1026,0,__PYX_ERR(2, 1026, __pyx_L1_error))
16434 ((Py_buffer *)(&__pyx_v_result->__pyx_base.view))->obj = Py_None;
16443 __Pyx_TraceLine(1027,0,__PYX_ERR(2, 1027, __pyx_L1_error))
16444 Py_INCREF(Py_None);
16453 __Pyx_TraceLine(1029,0,__PYX_ERR(2, 1029, __pyx_L1_error))
16454 __pyx_t_1 = ((((
struct __pyx_memoryview_obj *)__pyx_v_memviewslice.memview)->flags & PyBUF_WRITABLE) != 0);
16464 __Pyx_TraceLine(1030,0,__PYX_ERR(2, 1030, __pyx_L1_error))
16465 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS;
16484 __Pyx_TraceLine(1032,0,__PYX_ERR(2, 1032, __pyx_L1_error))
16486 __pyx_v_result->__pyx_base.flags = PyBUF_RECORDS_RO;
16497 __Pyx_TraceLine(1034,0,__PYX_ERR(2, 1034, __pyx_L1_error))
16498 __pyx_v_result->__pyx_base.view.shape = ((Py_ssize_t *)__pyx_v_result->from_slice.shape);
16507 __Pyx_TraceLine(1035,0,__PYX_ERR(2, 1035, __pyx_L1_error))
16508 __pyx_v_result->__pyx_base.view.strides = ((Py_ssize_t *)__pyx_v_result->from_slice.strides);
16517 __Pyx_TraceLine(1038,0,__PYX_ERR(2, 1038, __pyx_L1_error))
16518 __pyx_v_result->__pyx_base.view.suboffsets = NULL;
16527 __Pyx_TraceLine(1039,0,__PYX_ERR(2, 1039, __pyx_L1_error))
16528 __pyx_t_7 = (__pyx_v_result->from_slice.suboffsets + __pyx_v_ndim);
16529 for (__pyx_t_8 = __pyx_v_result->from_slice.suboffsets; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16530 __pyx_t_6 = __pyx_t_8;
16531 __pyx_v_suboffset = (__pyx_t_6[0]);
16540 __Pyx_TraceLine(1040,0,__PYX_ERR(2, 1040, __pyx_L1_error))
16541 __pyx_t_1 = ((__pyx_v_suboffset >= 0) != 0);
16551 __Pyx_TraceLine(1041,0,__PYX_ERR(2, 1041, __pyx_L1_error))
16552 __pyx_v_result->__pyx_base.view.suboffsets = ((Py_ssize_t *)__pyx_v_result->from_slice.suboffsets);
16561 __Pyx_TraceLine(1042,0,__PYX_ERR(2, 1042, __pyx_L1_error))
16562 goto __pyx_L6_break;
16582 __Pyx_TraceLine(1044,0,__PYX_ERR(2, 1044, __pyx_L1_error))
16583 __pyx_t_9 = __pyx_v_result->__pyx_base.view.itemsize;
16584 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16593 __Pyx_TraceLine(1045,0,__PYX_ERR(2, 1045, __pyx_L1_error))
16594 __pyx_t_7 = (__pyx_v_result->__pyx_base.view.shape + __pyx_v_ndim);
16595 for (__pyx_t_8 = __pyx_v_result->__pyx_base.view.shape; __pyx_t_8 < __pyx_t_7; __pyx_t_8++) {
16596 __pyx_t_6 = __pyx_t_8;
16597 __pyx_t_2 = PyInt_FromSsize_t((__pyx_t_6[0]));
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1045, __pyx_L1_error)
16598 __Pyx_GOTREF(__pyx_t_2);
16599 __Pyx_XDECREF_SET(__pyx_v_length, __pyx_t_2);
16609 __Pyx_TraceLine(1046,0,__PYX_ERR(2, 1046, __pyx_L1_error))
16610 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_result->__pyx_base.view.len);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1046, __pyx_L1_error)
16611 __Pyx_GOTREF(__pyx_t_2);
16612 __pyx_t_3 = PyNumber_InPlaceMultiply(__pyx_t_2, __pyx_v_length);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1046, __pyx_L1_error)
16613 __Pyx_GOTREF(__pyx_t_3);
16614 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
16615 __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_t_3);
if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(2, 1046, __pyx_L1_error)
16616 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
16617 __pyx_v_result->__pyx_base.view.len = __pyx_t_9;
16627 __Pyx_TraceLine(1048,0,__PYX_ERR(2, 1048, __pyx_L1_error))
16628 __pyx_v_result->to_object_func = __pyx_v_to_object_func;
16637 __Pyx_TraceLine(1049,0,__PYX_ERR(2, 1049, __pyx_L1_error))
16638 __pyx_v_result->to_dtype_func = __pyx_v_to_dtype_func;
16647 __Pyx_TraceLine(1051,0,__PYX_ERR(2, 1051, __pyx_L1_error))
16648 __Pyx_XDECREF(__pyx_r);
16649 __Pyx_INCREF(((PyObject *)__pyx_v_result));
16650 __pyx_r = ((PyObject *)__pyx_v_result);
16663 __Pyx_XDECREF(__pyx_t_2);
16664 __Pyx_XDECREF(__pyx_t_3);
16665 __Pyx_AddTraceback(
"View.MemoryView.memoryview_fromslice", __pyx_clineno, __pyx_lineno, __pyx_filename);
16668 __Pyx_XDECREF((PyObject *)__pyx_v_result);
16669 __Pyx_XDECREF(__pyx_v_length);
16670 __Pyx_XGIVEREF(__pyx_r);
16671 __Pyx_TraceReturn(__pyx_r, 0);
16672 __Pyx_RefNannyFinishContext();
16684 static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_mslice) {
16685 struct __pyx_memoryviewslice_obj *__pyx_v_obj = 0;
16686 __Pyx_memviewslice *__pyx_r;
16687 __Pyx_TraceDeclarations
16688 __Pyx_RefNannyDeclarations
16691 PyObject *__pyx_t_3 = NULL;
16692 int __pyx_lineno = 0;
16693 const char *__pyx_filename = NULL;
16694 int __pyx_clineno = 0;
16695 __Pyx_RefNannySetupContext(
"get_slice_from_memview", 0);
16696 __Pyx_TraceCall(
"get_slice_from_memview", __pyx_f[2], 1054, 0, __PYX_ERR(2, 1054, __pyx_L1_error));
16705 __Pyx_TraceLine(1057,0,__PYX_ERR(2, 1057, __pyx_L1_error))
16706 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
16707 __pyx_t_2 = (__pyx_t_1 != 0);
16717 __Pyx_TraceLine(1058,0,__PYX_ERR(2, 1058, __pyx_L1_error))
16718 if (!(likely(((((PyObject *)__pyx_v_memview)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type))))) __PYX_ERR(2, 1058, __pyx_L1_error)
16719 __pyx_t_3 = ((PyObject *)__pyx_v_memview);
16720 __Pyx_INCREF(__pyx_t_3);
16721 __pyx_v_obj = ((
struct __pyx_memoryviewslice_obj *)__pyx_t_3);
16731 __Pyx_TraceLine(1059,0,__PYX_ERR(2, 1059, __pyx_L1_error))
16732 __pyx_r = (&__pyx_v_obj->from_slice);
16751 __Pyx_TraceLine(1061,0,__PYX_ERR(2, 1061, __pyx_L1_error))
16753 __pyx_memoryview_slice_copy(__pyx_v_memview, __pyx_v_mslice);
16762 __Pyx_TraceLine(1062,0,__PYX_ERR(2, 1062, __pyx_L1_error))
16763 __pyx_r = __pyx_v_mslice;
16777 __Pyx_XDECREF(__pyx_t_3);
16778 __Pyx_AddTraceback(
"View.MemoryView.get_slice_from_memview", __pyx_clineno, __pyx_lineno, __pyx_filename);
16781 __Pyx_XDECREF((PyObject *)__pyx_v_obj);
16782 __Pyx_TraceReturn(Py_None, 0);
16783 __Pyx_RefNannyFinishContext();
16795 static void __pyx_memoryview_slice_copy(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_dst) {
16797 Py_ssize_t *__pyx_v_shape;
16798 Py_ssize_t *__pyx_v_strides;
16799 Py_ssize_t *__pyx_v_suboffsets;
16800 __Pyx_TraceDeclarations
16801 __Pyx_RefNannyDeclarations
16802 Py_ssize_t *__pyx_t_1;
16806 Py_ssize_t __pyx_t_5;
16807 int __pyx_lineno = 0;
16808 const char *__pyx_filename = NULL;
16809 int __pyx_clineno = 0;
16810 __Pyx_RefNannySetupContext(
"slice_copy", 0);
16811 __Pyx_TraceCall(
"slice_copy", __pyx_f[2], 1065, 0, __PYX_ERR(2, 1065, __pyx_L1_error));
16820 __Pyx_TraceLine(1069,0,__PYX_ERR(2, 1069, __pyx_L1_error))
16821 __pyx_t_1 = __pyx_v_memview->view.shape;
16822 __pyx_v_shape = __pyx_t_1;
16831 __Pyx_TraceLine(1070,0,__PYX_ERR(2, 1070, __pyx_L1_error))
16832 __pyx_t_1 = __pyx_v_memview->view.strides;
16833 __pyx_v_strides = __pyx_t_1;
16842 __Pyx_TraceLine(1071,0,__PYX_ERR(2, 1071, __pyx_L1_error))
16843 __pyx_t_1 = __pyx_v_memview->view.suboffsets;
16844 __pyx_v_suboffsets = __pyx_t_1;
16853 __Pyx_TraceLine(1073,0,__PYX_ERR(2, 1073, __pyx_L1_error))
16854 __pyx_v_dst->memview = ((
struct __pyx_memoryview_obj *)__pyx_v_memview);
16863 __Pyx_TraceLine(1074,0,__PYX_ERR(2, 1074, __pyx_L1_error))
16864 __pyx_v_dst->data = ((
char *)__pyx_v_memview->view.buf);
16873 __Pyx_TraceLine(1076,0,__PYX_ERR(2, 1076, __pyx_L1_error))
16874 __pyx_t_2 = __pyx_v_memview->view.ndim;
16875 __pyx_t_3 = __pyx_t_2;
16876 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
16877 __pyx_v_dim = __pyx_t_4;
16886 __Pyx_TraceLine(1077,0,__PYX_ERR(2, 1077, __pyx_L1_error))
16887 (__pyx_v_dst->shape[__pyx_v_dim]) = (__pyx_v_shape[__pyx_v_dim]);
16896 __Pyx_TraceLine(1078,0,__PYX_ERR(2, 1078, __pyx_L1_error))
16897 (__pyx_v_dst->strides[__pyx_v_dim]) = (__pyx_v_strides[__pyx_v_dim]);
16906 __Pyx_TraceLine(1079,0,__PYX_ERR(2, 1079, __pyx_L1_error))
16907 if ((__pyx_v_suboffsets != 0)) {
16908 __pyx_t_5 = (__pyx_v_suboffsets[__pyx_v_dim]);
16912 (__pyx_v_dst->suboffsets[__pyx_v_dim]) = __pyx_t_5;
16926 __Pyx_WriteUnraisable(
"View.MemoryView.slice_copy", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
16928 __Pyx_TraceReturn(Py_None, 0);
16929 __Pyx_RefNannyFinishContext();
16940 static PyObject *__pyx_memoryview_copy_object(
struct __pyx_memoryview_obj *__pyx_v_memview) {
16941 __Pyx_memviewslice __pyx_v_memviewslice;
16942 PyObject *__pyx_r = NULL;
16943 __Pyx_TraceDeclarations
16944 __Pyx_RefNannyDeclarations
16945 PyObject *__pyx_t_1 = NULL;
16946 int __pyx_lineno = 0;
16947 const char *__pyx_filename = NULL;
16948 int __pyx_clineno = 0;
16949 __Pyx_RefNannySetupContext(
"memoryview_copy", 0);
16950 __Pyx_TraceCall(
"memoryview_copy", __pyx_f[2], 1082, 0, __PYX_ERR(2, 1082, __pyx_L1_error));
16959 __Pyx_TraceLine(1085,0,__PYX_ERR(2, 1085, __pyx_L1_error))
16960 __pyx_memoryview_slice_copy(__pyx_v_memview, (&__pyx_v_memviewslice));
16969 __Pyx_TraceLine(1086,0,__PYX_ERR(2, 1086, __pyx_L1_error))
16970 __Pyx_XDECREF(__pyx_r);
16971 __pyx_t_1 = __pyx_memoryview_copy_object_from_slice(__pyx_v_memview, (&__pyx_v_memviewslice));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1086, __pyx_L1_error)
16972 __Pyx_GOTREF(__pyx_t_1);
16973 __pyx_r = __pyx_t_1;
16987 __Pyx_XDECREF(__pyx_t_1);
16988 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy", __pyx_clineno, __pyx_lineno, __pyx_filename);
16991 __Pyx_XGIVEREF(__pyx_r);
16992 __Pyx_TraceReturn(__pyx_r, 0);
16993 __Pyx_RefNannyFinishContext();
17005 static PyObject *__pyx_memoryview_copy_object_from_slice(
struct __pyx_memoryview_obj *__pyx_v_memview, __Pyx_memviewslice *__pyx_v_memviewslice) {
17006 PyObject *(*__pyx_v_to_object_func)(
char *);
17007 int (*__pyx_v_to_dtype_func)(
char *, PyObject *);
17008 PyObject *__pyx_r = NULL;
17009 __Pyx_TraceDeclarations
17010 __Pyx_RefNannyDeclarations
17013 PyObject *(*__pyx_t_3)(
char *);
17014 int (*__pyx_t_4)(
char *, PyObject *);
17015 PyObject *__pyx_t_5 = NULL;
17016 int __pyx_lineno = 0;
17017 const char *__pyx_filename = NULL;
17018 int __pyx_clineno = 0;
17019 __Pyx_RefNannySetupContext(
"memoryview_copy_from_slice", 0);
17020 __Pyx_TraceCall(
"memoryview_copy_from_slice", __pyx_f[2], 1089, 0, __PYX_ERR(2, 1089, __pyx_L1_error));
17029 __Pyx_TraceLine(1096,0,__PYX_ERR(2, 1096, __pyx_L1_error))
17030 __pyx_t_1 = __Pyx_TypeCheck(((PyObject *)__pyx_v_memview), __pyx_memoryviewslice_type);
17031 __pyx_t_2 = (__pyx_t_1 != 0);
17041 __Pyx_TraceLine(1097,0,__PYX_ERR(2, 1097, __pyx_L1_error))
17042 __pyx_t_3 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_object_func;
17043 __pyx_v_to_object_func = __pyx_t_3;
17052 __Pyx_TraceLine(1098,0,__PYX_ERR(2, 1098, __pyx_L1_error))
17053 __pyx_t_4 = ((
struct __pyx_memoryviewslice_obj *)__pyx_v_memview)->to_dtype_func;
17054 __pyx_v_to_dtype_func = __pyx_t_4;
17073 __Pyx_TraceLine(1100,0,__PYX_ERR(2, 1100, __pyx_L1_error))
17075 __pyx_v_to_object_func = NULL;
17084 __Pyx_TraceLine(1101,0,__PYX_ERR(2, 1101, __pyx_L1_error))
17085 __pyx_v_to_dtype_func = NULL;
17096 __Pyx_TraceLine(1103,0,__PYX_ERR(2, 1103, __pyx_L1_error))
17097 __Pyx_XDECREF(__pyx_r);
17106 __Pyx_TraceLine(1105,0,__PYX_ERR(2, 1105, __pyx_L1_error))
17107 __pyx_t_5 = __pyx_memoryview_fromslice((__pyx_v_memviewslice[0]), __pyx_v_memview->view.ndim, __pyx_v_to_object_func, __pyx_v_to_dtype_func, __pyx_v_memview->dtype_is_object);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 1103, __pyx_L1_error)
17108 __Pyx_GOTREF(__pyx_t_5);
17109 __pyx_r = __pyx_t_5;
17123 __Pyx_XDECREF(__pyx_t_5);
17124 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_from_slice", __pyx_clineno, __pyx_lineno, __pyx_filename);
17127 __Pyx_XGIVEREF(__pyx_r);
17128 __Pyx_TraceReturn(__pyx_r, 0);
17129 __Pyx_RefNannyFinishContext();
17141 static Py_ssize_t abs_py_ssize_t(Py_ssize_t __pyx_v_arg) {
17142 Py_ssize_t __pyx_r;
17143 __Pyx_TraceDeclarations
17145 int __pyx_lineno = 0;
17146 const char *__pyx_filename = NULL;
17147 int __pyx_clineno = 0;
17148 __Pyx_TraceCall(
"abs_py_ssize_t", __pyx_f[2], 1111, 1, __PYX_ERR(2, 1111, __pyx_L1_error));
17157 __Pyx_TraceLine(1112,1,__PYX_ERR(2, 1112, __pyx_L1_error))
17158 __pyx_t_1 = ((__pyx_v_arg < 0) != 0);
17168 __Pyx_TraceLine(1113,1,__PYX_ERR(2, 1113, __pyx_L1_error))
17169 __pyx_r = (-__pyx_v_arg);
17188 __Pyx_TraceLine(1115,1,__PYX_ERR(2, 1115, __pyx_L1_error))
17190 __pyx_r = __pyx_v_arg;
17204 __Pyx_WriteUnraisable(
"View.MemoryView.abs_py_ssize_t", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17207 __Pyx_TraceReturn(Py_None, 1);
17219 static char __pyx_get_best_slice_order(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim) {
17221 Py_ssize_t __pyx_v_c_stride;
17222 Py_ssize_t __pyx_v_f_stride;
17224 __Pyx_TraceDeclarations
17229 int __pyx_lineno = 0;
17230 const char *__pyx_filename = NULL;
17231 int __pyx_clineno = 0;
17232 __Pyx_TraceCall(
"get_best_order", __pyx_f[2], 1118, 1, __PYX_ERR(2, 1118, __pyx_L1_error));
17241 __Pyx_TraceLine(1123,1,__PYX_ERR(2, 1123, __pyx_L1_error))
17242 __pyx_v_c_stride = 0;
17251 __Pyx_TraceLine(1124,1,__PYX_ERR(2, 1124, __pyx_L1_error))
17252 __pyx_v_f_stride = 0;
17261 __Pyx_TraceLine(1126,1,__PYX_ERR(2, 1126, __pyx_L1_error))
17262 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
17263 __pyx_v_i = __pyx_t_1;
17272 __Pyx_TraceLine(1127,1,__PYX_ERR(2, 1127, __pyx_L1_error))
17273 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17283 __Pyx_TraceLine(1128,1,__PYX_ERR(2, 1128, __pyx_L1_error))
17284 __pyx_v_c_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17293 __Pyx_TraceLine(1129,1,__PYX_ERR(2, 1129, __pyx_L1_error))
17294 goto __pyx_L4_break;
17314 __Pyx_TraceLine(1131,1,__PYX_ERR(2, 1131, __pyx_L1_error))
17315 __pyx_t_1 = __pyx_v_ndim;
17316 __pyx_t_3 = __pyx_t_1;
17317 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17318 __pyx_v_i = __pyx_t_4;
17327 __Pyx_TraceLine(1132,1,__PYX_ERR(2, 1132, __pyx_L1_error))
17328 __pyx_t_2 = (((__pyx_v_mslice->shape[__pyx_v_i]) > 1) != 0);
17338 __Pyx_TraceLine(1133,1,__PYX_ERR(2, 1133, __pyx_L1_error))
17339 __pyx_v_f_stride = (__pyx_v_mslice->strides[__pyx_v_i]);
17348 __Pyx_TraceLine(1134,1,__PYX_ERR(2, 1134, __pyx_L1_error))
17349 goto __pyx_L7_break;
17369 __Pyx_TraceLine(1136,1,__PYX_ERR(2, 1136, __pyx_L1_error))
17370 __pyx_t_2 = ((abs_py_ssize_t(__pyx_v_c_stride) <= abs_py_ssize_t(__pyx_v_f_stride)) != 0);
17380 __Pyx_TraceLine(1137,1,__PYX_ERR(2, 1137, __pyx_L1_error))
17400 __Pyx_TraceLine(1139,1,__PYX_ERR(2, 1139, __pyx_L1_error))
17416 __Pyx_WriteUnraisable(
"View.MemoryView.get_best_order", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17419 __Pyx_TraceReturn(Py_None, 1);
17431 static void _copy_strided_to_strided(
char *__pyx_v_src_data, Py_ssize_t *__pyx_v_src_strides,
char *__pyx_v_dst_data, Py_ssize_t *__pyx_v_dst_strides, Py_ssize_t *__pyx_v_src_shape, Py_ssize_t *__pyx_v_dst_shape,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17432 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
17433 CYTHON_UNUSED Py_ssize_t __pyx_v_src_extent;
17434 Py_ssize_t __pyx_v_dst_extent;
17435 Py_ssize_t __pyx_v_src_stride;
17436 Py_ssize_t __pyx_v_dst_stride;
17440 Py_ssize_t __pyx_t_4;
17441 Py_ssize_t __pyx_t_5;
17442 Py_ssize_t __pyx_t_6;
17451 __pyx_v_src_extent = (__pyx_v_src_shape[0]);
17460 __pyx_v_dst_extent = (__pyx_v_dst_shape[0]);
17469 __pyx_v_src_stride = (__pyx_v_src_strides[0]);
17478 __pyx_v_dst_stride = (__pyx_v_dst_strides[0]);
17487 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
17497 __pyx_t_2 = ((__pyx_v_src_stride > 0) != 0);
17500 __pyx_t_1 = __pyx_t_2;
17501 goto __pyx_L5_bool_binop_done;
17503 __pyx_t_2 = ((__pyx_v_dst_stride > 0) != 0);
17506 __pyx_t_1 = __pyx_t_2;
17507 goto __pyx_L5_bool_binop_done;
17517 __pyx_t_2 = (((size_t)__pyx_v_src_stride) == __pyx_v_itemsize);
17519 __pyx_t_2 = (__pyx_v_itemsize == ((size_t)__pyx_v_dst_stride));
17521 __pyx_t_3 = (__pyx_t_2 != 0);
17522 __pyx_t_1 = __pyx_t_3;
17523 __pyx_L5_bool_binop_done:;
17541 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, (__pyx_v_itemsize * __pyx_v_dst_extent)));
17561 __pyx_t_4 = __pyx_v_dst_extent;
17562 __pyx_t_5 = __pyx_t_4;
17563 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17564 __pyx_v_i = __pyx_t_6;
17573 (void)(memcpy(__pyx_v_dst_data, __pyx_v_src_data, __pyx_v_itemsize));
17582 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17591 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17614 __pyx_t_4 = __pyx_v_dst_extent;
17615 __pyx_t_5 = __pyx_t_4;
17616 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
17617 __pyx_v_i = __pyx_t_6;
17626 _copy_strided_to_strided(__pyx_v_src_data, (__pyx_v_src_strides + 1), __pyx_v_dst_data, (__pyx_v_dst_strides + 1), (__pyx_v_src_shape + 1), (__pyx_v_dst_shape + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize);
17635 __pyx_v_src_data = (__pyx_v_src_data + __pyx_v_src_stride);
17644 __pyx_v_dst_data = (__pyx_v_dst_data + __pyx_v_dst_stride);
17668 static void copy_strided_to_strided(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize) {
17669 __Pyx_TraceDeclarations
17670 int __pyx_lineno = 0;
17671 const char *__pyx_filename = NULL;
17672 int __pyx_clineno = 0;
17673 __Pyx_TraceCall(
"copy_strided_to_strided", __pyx_f[2], 1172, 1, __PYX_ERR(2, 1172, __pyx_L1_error));
17682 __Pyx_TraceLine(1175,1,__PYX_ERR(2, 1175, __pyx_L1_error))
17683 _copy_strided_to_strided(__pyx_v_src->data, __pyx_v_src->strides, __pyx_v_dst->data, __pyx_v_dst->strides, __pyx_v_src->shape, __pyx_v_dst->shape, __pyx_v_ndim, __pyx_v_itemsize);
17696 __Pyx_WriteUnraisable(
"View.MemoryView.copy_strided_to_strided", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17698 __Pyx_TraceReturn(Py_None, 1);
17709 static Py_ssize_t __pyx_memoryview_slice_get_size(__Pyx_memviewslice *__pyx_v_src,
int __pyx_v_ndim) {
17710 Py_ssize_t __pyx_v_shape;
17711 Py_ssize_t __pyx_v_size;
17712 Py_ssize_t __pyx_r;
17713 __Pyx_TraceDeclarations
17714 Py_ssize_t __pyx_t_1;
17715 Py_ssize_t *__pyx_t_2;
17716 Py_ssize_t *__pyx_t_3;
17717 Py_ssize_t *__pyx_t_4;
17718 int __pyx_lineno = 0;
17719 const char *__pyx_filename = NULL;
17720 int __pyx_clineno = 0;
17721 __Pyx_TraceCall(
"slice_get_size", __pyx_f[2], 1179, 1, __PYX_ERR(2, 1179, __pyx_L1_error));
17730 __Pyx_TraceLine(1181,1,__PYX_ERR(2, 1181, __pyx_L1_error))
17731 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17732 __pyx_v_size = __pyx_t_1;
17741 __Pyx_TraceLine(1183,1,__PYX_ERR(2, 1183, __pyx_L1_error))
17742 __pyx_t_3 = (__pyx_v_src->shape + __pyx_v_ndim);
17743 for (__pyx_t_4 = __pyx_v_src->shape; __pyx_t_4 < __pyx_t_3; __pyx_t_4++) {
17744 __pyx_t_2 = __pyx_t_4;
17745 __pyx_v_shape = (__pyx_t_2[0]);
17754 __Pyx_TraceLine(1184,1,__PYX_ERR(2, 1184, __pyx_L1_error))
17755 __pyx_v_size = (__pyx_v_size * __pyx_v_shape);
17765 __Pyx_TraceLine(1186,1,__PYX_ERR(2, 1186, __pyx_L1_error))
17766 __pyx_r = __pyx_v_size;
17779 __Pyx_WriteUnraisable(
"View.MemoryView.slice_get_size", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17782 __Pyx_TraceReturn(Py_None, 1);
17794 static Py_ssize_t __pyx_fill_contig_strides_array(Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides, Py_ssize_t __pyx_v_stride,
int __pyx_v_ndim,
char __pyx_v_order) {
17796 Py_ssize_t __pyx_r;
17797 __Pyx_TraceDeclarations
17802 int __pyx_lineno = 0;
17803 const char *__pyx_filename = NULL;
17804 int __pyx_clineno = 0;
17805 __Pyx_TraceCall(
"fill_contig_strides_array", __pyx_f[2], 1189, 1, __PYX_ERR(2, 1189, __pyx_L1_error));
17814 __Pyx_TraceLine(1198,1,__PYX_ERR(2, 1198, __pyx_L1_error))
17815 __pyx_t_1 = ((__pyx_v_order ==
'F') != 0);
17825 __Pyx_TraceLine(1199,1,__PYX_ERR(2, 1199, __pyx_L1_error))
17826 __pyx_t_2 = __pyx_v_ndim;
17827 __pyx_t_3 = __pyx_t_2;
17828 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
17829 __pyx_v_idx = __pyx_t_4;
17838 __Pyx_TraceLine(1200,1,__PYX_ERR(2, 1200, __pyx_L1_error))
17839 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17848 __Pyx_TraceLine(1201,1,__PYX_ERR(2, 1201, __pyx_L1_error))
17849 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17869 __Pyx_TraceLine(1203,1,__PYX_ERR(2, 1203, __pyx_L1_error))
17871 for (__pyx_t_2 = (__pyx_v_ndim - 1); __pyx_t_2 > -1; __pyx_t_2-=1) {
17872 __pyx_v_idx = __pyx_t_2;
17881 __Pyx_TraceLine(1204,1,__PYX_ERR(2, 1204, __pyx_L1_error))
17882 (__pyx_v_strides[__pyx_v_idx]) = __pyx_v_stride;
17891 __Pyx_TraceLine(1205,1,__PYX_ERR(2, 1205, __pyx_L1_error))
17892 __pyx_v_stride = (__pyx_v_stride * (__pyx_v_shape[__pyx_v_idx]));
17904 __Pyx_TraceLine(1207,1,__PYX_ERR(2, 1207, __pyx_L1_error))
17905 __pyx_r = __pyx_v_stride;
17918 __Pyx_WriteUnraisable(
"View.MemoryView.fill_contig_strides_array", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
17921 __Pyx_TraceReturn(Py_None, 1);
17933 static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, __Pyx_memviewslice *__pyx_v_tmpslice,
char __pyx_v_order,
int __pyx_v_ndim) {
17935 void *__pyx_v_result;
17936 size_t __pyx_v_itemsize;
17937 size_t __pyx_v_size;
17939 __Pyx_TraceDeclarations
17940 Py_ssize_t __pyx_t_1;
17943 struct __pyx_memoryview_obj *__pyx_t_4;
17946 int __pyx_lineno = 0;
17947 const char *__pyx_filename = NULL;
17948 int __pyx_clineno = 0;
17949 __Pyx_TraceCall(
"copy_data_to_temp", __pyx_f[2], 1210, 1, __PYX_ERR(2, 1210, __pyx_L1_error));
17958 __Pyx_TraceLine(1221,1,__PYX_ERR(2, 1221, __pyx_L1_error))
17959 __pyx_t_1 = __pyx_v_src->memview->view.itemsize;
17960 __pyx_v_itemsize = __pyx_t_1;
17969 __Pyx_TraceLine(1222,1,__PYX_ERR(2, 1222, __pyx_L1_error))
17970 __pyx_v_size = __pyx_memoryview_slice_get_size(__pyx_v_src, __pyx_v_ndim);
17979 __Pyx_TraceLine(1224,1,__PYX_ERR(2, 1224, __pyx_L1_error))
17980 __pyx_v_result = malloc(__pyx_v_size);
17989 __Pyx_TraceLine(1225,1,__PYX_ERR(2, 1225, __pyx_L1_error))
17990 __pyx_t_2 = ((!(__pyx_v_result != 0)) != 0);
18000 __Pyx_TraceLine(1226,1,__PYX_ERR(2, 1226, __pyx_L1_error))
18001 __pyx_t_3 = __pyx_memoryview_err(__pyx_builtin_MemoryError, NULL);
if (unlikely(__pyx_t_3 == ((
int)-1))) __PYX_ERR(2, 1226, __pyx_L1_error)
18019 __Pyx_TraceLine(1229,1,__PYX_ERR(2, 1229, __pyx_L1_error))
18020 __pyx_v_tmpslice->data = ((
char *)__pyx_v_result);
18029 __Pyx_TraceLine(1230,1,__PYX_ERR(2, 1230, __pyx_L1_error))
18030 __pyx_t_4 = __pyx_v_src->memview;
18031 __pyx_v_tmpslice->memview = __pyx_t_4;
18040 __Pyx_TraceLine(1231,1,__PYX_ERR(2, 1231, __pyx_L1_error))
18041 __pyx_t_3 = __pyx_v_ndim;
18042 __pyx_t_5 = __pyx_t_3;
18043 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18044 __pyx_v_i = __pyx_t_6;
18053 __Pyx_TraceLine(1232,1,__PYX_ERR(2, 1232, __pyx_L1_error))
18054 (__pyx_v_tmpslice->shape[__pyx_v_i]) = (__pyx_v_src->shape[__pyx_v_i]);
18063 __Pyx_TraceLine(1233,1,__PYX_ERR(2, 1233, __pyx_L1_error))
18064 (__pyx_v_tmpslice->suboffsets[__pyx_v_i]) = -1L;
18074 __Pyx_TraceLine(1235,1,__PYX_ERR(2, 1235, __pyx_L1_error))
18075 (void)(__pyx_fill_contig_strides_array((&(__pyx_v_tmpslice->shape[0])), (&(__pyx_v_tmpslice->strides[0])), __pyx_v_itemsize, __pyx_v_ndim, __pyx_v_order));
18084 __Pyx_TraceLine(1239,1,__PYX_ERR(2, 1239, __pyx_L1_error))
18085 __pyx_t_3 = __pyx_v_ndim;
18086 __pyx_t_5 = __pyx_t_3;
18087 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) {
18088 __pyx_v_i = __pyx_t_6;
18097 __Pyx_TraceLine(1240,1,__PYX_ERR(2, 1240, __pyx_L1_error))
18098 __pyx_t_2 = (((__pyx_v_tmpslice->shape[__pyx_v_i]) == 1) != 0);
18108 __Pyx_TraceLine(1241,1,__PYX_ERR(2, 1241, __pyx_L1_error))
18109 (__pyx_v_tmpslice->strides[__pyx_v_i]) = 0;
18128 __Pyx_TraceLine(1243,1,__PYX_ERR(2, 1243, __pyx_L1_error))
18129 __pyx_t_2 = (__pyx_memviewslice_is_contig((__pyx_v_src[0]), __pyx_v_order, __pyx_v_ndim) != 0);
18139 __Pyx_TraceLine(1244,1,__PYX_ERR(2, 1244, __pyx_L1_error))
18140 (void)(memcpy(__pyx_v_result, __pyx_v_src->data, __pyx_v_size));
18159 __Pyx_TraceLine(1246,1,__PYX_ERR(2, 1246, __pyx_L1_error))
18161 copy_strided_to_strided(__pyx_v_src, __pyx_v_tmpslice, __pyx_v_ndim, __pyx_v_itemsize);
18172 __Pyx_TraceLine(1248,1,__PYX_ERR(2, 1248, __pyx_L1_error))
18173 __pyx_r = __pyx_v_result;
18188 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18190 __Pyx_AddTraceback(
"View.MemoryView.copy_data_to_temp", __pyx_clineno, __pyx_lineno, __pyx_filename);
18192 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18197 __Pyx_TraceReturn(Py_None, 1);
18209 static int __pyx_memoryview_err_extents(
int __pyx_v_i, Py_ssize_t __pyx_v_extent1, Py_ssize_t __pyx_v_extent2) {
18211 __Pyx_TraceDeclarations
18212 __Pyx_RefNannyDeclarations
18213 PyObject *__pyx_t_1 = NULL;
18214 PyObject *__pyx_t_2 = NULL;
18215 PyObject *__pyx_t_3 = NULL;
18216 PyObject *__pyx_t_4 = NULL;
18217 int __pyx_lineno = 0;
18218 const char *__pyx_filename = NULL;
18219 int __pyx_clineno = 0;
18221 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18223 __Pyx_RefNannySetupContext(
"_err_extents", 0);
18224 __Pyx_TraceCall(
"_err_extents", __pyx_f[2], 1253, 0, __PYX_ERR(2, 1253, __pyx_L1_error));
18233 __Pyx_TraceLine(1256,0,__PYX_ERR(2, 1256, __pyx_L1_error))
18234 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_i);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1256, __pyx_L1_error)
18235 __Pyx_GOTREF(__pyx_t_1);
18236 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_extent1);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1256, __pyx_L1_error)
18237 __Pyx_GOTREF(__pyx_t_2);
18238 __pyx_t_3 = PyInt_FromSsize_t(__pyx_v_extent2);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1256, __pyx_L1_error)
18239 __Pyx_GOTREF(__pyx_t_3);
18240 __pyx_t_4 = PyTuple_New(3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1256, __pyx_L1_error)
18241 __Pyx_GOTREF(__pyx_t_4);
18242 __Pyx_GIVEREF(__pyx_t_1);
18243 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
18244 __Pyx_GIVEREF(__pyx_t_2);
18245 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2);
18246 __Pyx_GIVEREF(__pyx_t_3);
18247 PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3);
18259 __Pyx_TraceLine(1255,0,__PYX_ERR(2, 1255, __pyx_L1_error))
18260 __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_t_4);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1255, __pyx_L1_error)
18261 __Pyx_GOTREF(__pyx_t_3);
18262 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18263 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1255, __pyx_L1_error)
18264 __Pyx_GOTREF(__pyx_t_4);
18265 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18266 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
18267 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18268 __PYX_ERR(2, 1255, __pyx_L1_error)
18280 __Pyx_XDECREF(__pyx_t_1);
18281 __Pyx_XDECREF(__pyx_t_2);
18282 __Pyx_XDECREF(__pyx_t_3);
18283 __Pyx_XDECREF(__pyx_t_4);
18284 __Pyx_AddTraceback(
"View.MemoryView._err_extents", __pyx_clineno, __pyx_lineno, __pyx_filename);
18286 __Pyx_TraceReturn(Py_None, 0);
18287 __Pyx_RefNannyFinishContext();
18289 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18302 static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error,
char *__pyx_v_msg,
int __pyx_v_dim) {
18304 __Pyx_TraceDeclarations
18305 __Pyx_RefNannyDeclarations
18306 PyObject *__pyx_t_1 = NULL;
18307 PyObject *__pyx_t_2 = NULL;
18308 PyObject *__pyx_t_3 = NULL;
18309 PyObject *__pyx_t_4 = NULL;
18310 int __pyx_lineno = 0;
18311 const char *__pyx_filename = NULL;
18312 int __pyx_clineno = 0;
18314 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18316 __Pyx_RefNannySetupContext(
"_err_dim", 0);
18317 __Pyx_TraceCall(
"_err_dim", __pyx_f[2], 1259, 0, __PYX_ERR(2, 1259, __pyx_L1_error));
18318 __Pyx_INCREF(__pyx_v_error);
18327 __Pyx_TraceLine(1260,0,__PYX_ERR(2, 1260, __pyx_L1_error))
18328 __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1260, __pyx_L1_error)
18329 __Pyx_GOTREF(__pyx_t_2);
18330 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dim);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1260, __pyx_L1_error)
18331 __Pyx_GOTREF(__pyx_t_3);
18332 __pyx_t_4 = PyUnicode_Format(__pyx_t_2, __pyx_t_3);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 1260, __pyx_L1_error)
18333 __Pyx_GOTREF(__pyx_t_4);
18334 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18335 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18336 __Pyx_INCREF(__pyx_v_error);
18337 __pyx_t_3 = __pyx_v_error; __pyx_t_2 = NULL;
18338 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
18339 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
18340 if (likely(__pyx_t_2)) {
18341 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_3);
18342 __Pyx_INCREF(__pyx_t_2);
18343 __Pyx_INCREF(
function);
18344 __Pyx_DECREF_SET(__pyx_t_3,
function);
18347 __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_2, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4);
18348 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
18349 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18350 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1260, __pyx_L1_error)
18351 __Pyx_GOTREF(__pyx_t_1);
18352 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18353 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
18354 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
18355 __PYX_ERR(2, 1260, __pyx_L1_error)
18367 __Pyx_XDECREF(__pyx_t_1);
18368 __Pyx_XDECREF(__pyx_t_2);
18369 __Pyx_XDECREF(__pyx_t_3);
18370 __Pyx_XDECREF(__pyx_t_4);
18371 __Pyx_AddTraceback(
"View.MemoryView._err_dim", __pyx_clineno, __pyx_lineno, __pyx_filename);
18373 __Pyx_XDECREF(__pyx_v_error);
18374 __Pyx_TraceReturn(Py_None, 0);
18375 __Pyx_RefNannyFinishContext();
18377 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18390 static int __pyx_memoryview_err(PyObject *__pyx_v_error,
char *__pyx_v_msg) {
18392 __Pyx_TraceDeclarations
18393 __Pyx_RefNannyDeclarations
18395 PyObject *__pyx_t_2 = NULL;
18396 PyObject *__pyx_t_3 = NULL;
18397 PyObject *__pyx_t_4 = NULL;
18398 PyObject *__pyx_t_5 = NULL;
18399 int __pyx_lineno = 0;
18400 const char *__pyx_filename = NULL;
18401 int __pyx_clineno = 0;
18403 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
18405 __Pyx_RefNannySetupContext(
"_err", 0);
18406 __Pyx_TraceCall(
"_err", __pyx_f[2], 1263, 0, __PYX_ERR(2, 1263, __pyx_L1_error));
18407 __Pyx_INCREF(__pyx_v_error);
18416 __Pyx_TraceLine(1264,0,__PYX_ERR(2, 1264, __pyx_L1_error))
18417 __pyx_t_1 = ((__pyx_v_msg != NULL) != 0);
18418 if (unlikely(__pyx_t_1)) {
18427 __Pyx_TraceLine(1265,0,__PYX_ERR(2, 1265, __pyx_L1_error))
18428 __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_msg, 0, strlen(__pyx_v_msg), NULL, NULL, PyUnicode_DecodeASCII);
if (unlikely(!__pyx_t_3)) __PYX_ERR(2, 1265, __pyx_L1_error)
18429 __Pyx_GOTREF(__pyx_t_3);
18430 __Pyx_INCREF(__pyx_v_error);
18431 __pyx_t_4 = __pyx_v_error; __pyx_t_5 = NULL;
18432 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) {
18433 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
18434 if (likely(__pyx_t_5)) {
18435 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_4);
18436 __Pyx_INCREF(__pyx_t_5);
18437 __Pyx_INCREF(
function);
18438 __Pyx_DECREF_SET(__pyx_t_4,
function);
18441 __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3);
18442 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
18443 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
18444 if (unlikely(!__pyx_t_2)) __PYX_ERR(2, 1265, __pyx_L1_error)
18445 __Pyx_GOTREF(__pyx_t_2);
18446 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
18447 __Pyx_Raise(__pyx_t_2, 0, 0, 0);
18448 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
18449 __PYX_ERR(2, 1265, __pyx_L1_error)
18467 __Pyx_TraceLine(1267,0,__PYX_ERR(2, 1267, __pyx_L1_error))
18469 __Pyx_Raise(__pyx_v_error, 0, 0, 0);
18470 __PYX_ERR(2, 1267, __pyx_L1_error)
18483 __Pyx_XDECREF(__pyx_t_2);
18484 __Pyx_XDECREF(__pyx_t_3);
18485 __Pyx_XDECREF(__pyx_t_4);
18486 __Pyx_XDECREF(__pyx_t_5);
18487 __Pyx_AddTraceback(
"View.MemoryView._err", __pyx_clineno, __pyx_lineno, __pyx_filename);
18489 __Pyx_XDECREF(__pyx_v_error);
18490 __Pyx_TraceReturn(Py_None, 0);
18491 __Pyx_RefNannyFinishContext();
18493 __Pyx_PyGILState_Release(__pyx_gilstate_save);
18506 static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_memviewslice __pyx_v_dst,
int __pyx_v_src_ndim,
int __pyx_v_dst_ndim,
int __pyx_v_dtype_is_object) {
18507 void *__pyx_v_tmpdata;
18508 size_t __pyx_v_itemsize;
18510 char __pyx_v_order;
18511 int __pyx_v_broadcasting;
18512 int __pyx_v_direct_copy;
18513 __Pyx_memviewslice __pyx_v_tmp;
18516 __Pyx_TraceDeclarations
18517 Py_ssize_t __pyx_t_1;
18525 int __pyx_lineno = 0;
18526 const char *__pyx_filename = NULL;
18527 int __pyx_clineno = 0;
18528 __Pyx_TraceCall(
"memoryview_copy_contents", __pyx_f[2], 1270, 1, __PYX_ERR(2, 1270, __pyx_L1_error));
18537 __Pyx_TraceLine(1278,1,__PYX_ERR(2, 1278, __pyx_L1_error))
18538 __pyx_v_tmpdata = NULL;
18547 __Pyx_TraceLine(1279,1,__PYX_ERR(2, 1279, __pyx_L1_error))
18548 __pyx_t_1 = __pyx_v_src.memview->view.itemsize;
18549 __pyx_v_itemsize = __pyx_t_1;
18558 __Pyx_TraceLine(1281,1,__PYX_ERR(2, 1281, __pyx_L1_error))
18559 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_src), __pyx_v_src_ndim);
18568 __Pyx_TraceLine(1282,1,__PYX_ERR(2, 1282, __pyx_L1_error))
18569 __pyx_v_broadcasting = 0;
18578 __Pyx_TraceLine(1283,1,__PYX_ERR(2, 1283, __pyx_L1_error))
18579 __pyx_v_direct_copy = 0;
18588 __Pyx_TraceLine(1286,1,__PYX_ERR(2, 1286, __pyx_L1_error))
18589 __pyx_t_2 = ((__pyx_v_src_ndim < __pyx_v_dst_ndim) != 0);
18599 __Pyx_TraceLine(1287,1,__PYX_ERR(2, 1287, __pyx_L1_error))
18600 __pyx_memoryview_broadcast_leading((&__pyx_v_src), __pyx_v_src_ndim, __pyx_v_dst_ndim);
18619 __Pyx_TraceLine(1288,1,__PYX_ERR(2, 1288, __pyx_L1_error))
18620 __pyx_t_2 = ((__pyx_v_dst_ndim < __pyx_v_src_ndim) != 0);
18630 __Pyx_TraceLine(1289,1,__PYX_ERR(2, 1289, __pyx_L1_error))
18631 __pyx_memoryview_broadcast_leading((&__pyx_v_dst), __pyx_v_dst_ndim, __pyx_v_src_ndim);
18650 __Pyx_TraceLine(1291,1,__PYX_ERR(2, 1291, __pyx_L1_error))
18651 __pyx_t_3 = __pyx_v_dst_ndim;
18652 __pyx_t_4 = __pyx_v_src_ndim;
18653 if (((__pyx_t_3 > __pyx_t_4) != 0)) {
18654 __pyx_t_5 = __pyx_t_3;
18656 __pyx_t_5 = __pyx_t_4;
18658 __pyx_v_ndim = __pyx_t_5;
18667 __Pyx_TraceLine(1293,1,__PYX_ERR(2, 1293, __pyx_L1_error))
18668 __pyx_t_5 = __pyx_v_ndim;
18669 __pyx_t_3 = __pyx_t_5;
18670 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
18671 __pyx_v_i = __pyx_t_4;
18680 __Pyx_TraceLine(1294,1,__PYX_ERR(2, 1294, __pyx_L1_error))
18681 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) != (__pyx_v_dst.shape[__pyx_v_i])) != 0);
18691 __Pyx_TraceLine(1295,1,__PYX_ERR(2, 1295, __pyx_L1_error))
18692 __pyx_t_2 = (((__pyx_v_src.shape[__pyx_v_i]) == 1) != 0);
18702 __Pyx_TraceLine(1296,1,__PYX_ERR(2, 1296, __pyx_L1_error))
18703 __pyx_v_broadcasting = 1;
18712 __Pyx_TraceLine(1297,1,__PYX_ERR(2, 1297, __pyx_L1_error))
18713 (__pyx_v_src.strides[__pyx_v_i]) = 0;
18732 __Pyx_TraceLine(1299,1,__PYX_ERR(2, 1299, __pyx_L1_error))
18734 __pyx_t_6 = __pyx_memoryview_err_extents(__pyx_v_i, (__pyx_v_dst.shape[__pyx_v_i]), (__pyx_v_src.shape[__pyx_v_i]));
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 1299, __pyx_L1_error)
18754 __Pyx_TraceLine(1301,1,__PYX_ERR(2, 1301, __pyx_L1_error))
18755 __pyx_t_2 = (((__pyx_v_src.suboffsets[__pyx_v_i]) >= 0) != 0);
18765 __Pyx_TraceLine(1302,1,__PYX_ERR(2, 1302, __pyx_L1_error))
18766 __pyx_t_6 = __pyx_memoryview_err_dim(__pyx_builtin_ValueError, ((
char *)
"Dimension %d is not direct"), __pyx_v_i);
if (unlikely(__pyx_t_6 == ((
int)-1))) __PYX_ERR(2, 1302, __pyx_L1_error)
18785 __Pyx_TraceLine(1304,1,__PYX_ERR(2, 1304, __pyx_L1_error))
18786 __pyx_t_2 = (__pyx_slices_overlap((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize) != 0);
18796 __Pyx_TraceLine(1306,1,__PYX_ERR(2, 1306, __pyx_L1_error))
18797 __pyx_t_2 = ((!(__pyx_memviewslice_is_contig(__pyx_v_src, __pyx_v_order, __pyx_v_ndim) != 0)) != 0);
18807 __Pyx_TraceLine(1307,1,__PYX_ERR(2, 1307, __pyx_L1_error))
18808 __pyx_v_order = __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim);
18826 __Pyx_TraceLine(1309,1,__PYX_ERR(2, 1309, __pyx_L1_error))
18827 __pyx_t_7 = __pyx_memoryview_copy_data_to_temp((&__pyx_v_src), (&__pyx_v_tmp), __pyx_v_order, __pyx_v_ndim);
if (unlikely(__pyx_t_7 == ((
void *)NULL))) __PYX_ERR(2, 1309, __pyx_L1_error)
18828 __pyx_v_tmpdata = __pyx_t_7;
18837 __Pyx_TraceLine(1310,1,__PYX_ERR(2, 1310, __pyx_L1_error))
18838 __pyx_v_src = __pyx_v_tmp;
18856 __Pyx_TraceLine(1312,1,__PYX_ERR(2, 1312, __pyx_L1_error))
18857 __pyx_t_2 = ((!(__pyx_v_broadcasting != 0)) != 0);
18867 __Pyx_TraceLine(1315,1,__PYX_ERR(2, 1315, __pyx_L1_error))
18868 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'C', __pyx_v_ndim) != 0);
18878 __Pyx_TraceLine(1316,1,__PYX_ERR(2, 1316, __pyx_L1_error))
18879 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'C', __pyx_v_ndim);
18898 __Pyx_TraceLine(1317,1,__PYX_ERR(2, 1317, __pyx_L1_error))
18899 __pyx_t_2 = (__pyx_memviewslice_is_contig(__pyx_v_src,
'F', __pyx_v_ndim) != 0);
18909 __Pyx_TraceLine(1318,1,__PYX_ERR(2, 1318, __pyx_L1_error))
18910 __pyx_v_direct_copy = __pyx_memviewslice_is_contig(__pyx_v_dst,
'F', __pyx_v_ndim);
18929 __Pyx_TraceLine(1320,1,__PYX_ERR(2, 1320, __pyx_L1_error))
18930 __pyx_t_2 = (__pyx_v_direct_copy != 0);
18940 __Pyx_TraceLine(1322,1,__PYX_ERR(2, 1322, __pyx_L1_error))
18941 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
18950 __Pyx_TraceLine(1323,1,__PYX_ERR(2, 1323, __pyx_L1_error))
18951 (void)(memcpy(__pyx_v_dst.data, __pyx_v_src.data, __pyx_memoryview_slice_get_size((&__pyx_v_src), __pyx_v_ndim)));
18960 __Pyx_TraceLine(1324,1,__PYX_ERR(2, 1324, __pyx_L1_error))
18961 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
18970 __Pyx_TraceLine(1325,1,__PYX_ERR(2, 1325, __pyx_L1_error))
18971 free(__pyx_v_tmpdata);
18980 __Pyx_TraceLine(1326,1,__PYX_ERR(2, 1326, __pyx_L1_error))
19009 __Pyx_TraceLine(1328,1,__PYX_ERR(2, 1328, __pyx_L1_error))
19010 __pyx_t_2 = (__pyx_v_order ==
'F');
19012 __pyx_t_2 = (
'F' == __pyx_get_best_slice_order((&__pyx_v_dst), __pyx_v_ndim));
19014 __pyx_t_8 = (__pyx_t_2 != 0);
19024 __Pyx_TraceLine(1331,1,__PYX_ERR(2, 1331, __pyx_L1_error))
19025 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_src));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1331, __pyx_L1_error)
19034 __Pyx_TraceLine(1332,1,__PYX_ERR(2, 1332, __pyx_L1_error))
19035 __pyx_t_5 = __pyx_memslice_transpose((&__pyx_v_dst));
if (unlikely(__pyx_t_5 == ((
int)0))) __PYX_ERR(2, 1332, __pyx_L1_error)
19053 __Pyx_TraceLine(1334,1,__PYX_ERR(2, 1334, __pyx_L1_error))
19054 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19063 __Pyx_TraceLine(1335,1,__PYX_ERR(2, 1335, __pyx_L1_error))
19064 copy_strided_to_strided((&__pyx_v_src), (&__pyx_v_dst), __pyx_v_ndim, __pyx_v_itemsize);
19073 __Pyx_TraceLine(1336,1,__PYX_ERR(2, 1336, __pyx_L1_error))
19074 __pyx_memoryview_refcount_copying((&__pyx_v_dst), __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19083 __Pyx_TraceLine(1338,1,__PYX_ERR(2, 1338, __pyx_L1_error))
19084 free(__pyx_v_tmpdata);
19093 __Pyx_TraceLine(1339,1,__PYX_ERR(2, 1339, __pyx_L1_error))
19109 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19111 __Pyx_AddTraceback(
"View.MemoryView.memoryview_copy_contents", __pyx_clineno, __pyx_lineno, __pyx_filename);
19113 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19118 __Pyx_TraceReturn(Py_None, 1);
19130 static void __pyx_memoryview_broadcast_leading(__Pyx_memviewslice *__pyx_v_mslice,
int __pyx_v_ndim,
int __pyx_v_ndim_other) {
19132 int __pyx_v_offset;
19133 __Pyx_TraceDeclarations
19137 int __pyx_lineno = 0;
19138 const char *__pyx_filename = NULL;
19139 int __pyx_clineno = 0;
19140 __Pyx_TraceCall(
"broadcast_leading", __pyx_f[2], 1342, 1, __PYX_ERR(2, 1342, __pyx_L1_error));
19149 __Pyx_TraceLine(1346,1,__PYX_ERR(2, 1346, __pyx_L1_error))
19150 __pyx_v_offset = (__pyx_v_ndim_other - __pyx_v_ndim);
19159 __Pyx_TraceLine(1348,1,__PYX_ERR(2, 1348, __pyx_L1_error))
19160 for (__pyx_t_1 = (__pyx_v_ndim - 1); __pyx_t_1 > -1; __pyx_t_1-=1) {
19161 __pyx_v_i = __pyx_t_1;
19170 __Pyx_TraceLine(1349,1,__PYX_ERR(2, 1349, __pyx_L1_error))
19171 (__pyx_v_mslice->shape[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->shape[__pyx_v_i]);
19180 __Pyx_TraceLine(1350,1,__PYX_ERR(2, 1350, __pyx_L1_error))
19181 (__pyx_v_mslice->strides[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->strides[__pyx_v_i]);
19190 __Pyx_TraceLine(1351,1,__PYX_ERR(2, 1351, __pyx_L1_error))
19191 (__pyx_v_mslice->suboffsets[(__pyx_v_i + __pyx_v_offset)]) = (__pyx_v_mslice->suboffsets[__pyx_v_i]);
19201 __Pyx_TraceLine(1353,1,__PYX_ERR(2, 1353, __pyx_L1_error))
19202 __pyx_t_1 = __pyx_v_offset;
19203 __pyx_t_2 = __pyx_t_1;
19204 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19205 __pyx_v_i = __pyx_t_3;
19214 __Pyx_TraceLine(1354,1,__PYX_ERR(2, 1354, __pyx_L1_error))
19215 (__pyx_v_mslice->shape[__pyx_v_i]) = 1;
19224 __Pyx_TraceLine(1355,1,__PYX_ERR(2, 1355, __pyx_L1_error))
19225 (__pyx_v_mslice->strides[__pyx_v_i]) = (__pyx_v_mslice->strides[0]);
19234 __Pyx_TraceLine(1356,1,__PYX_ERR(2, 1356, __pyx_L1_error))
19235 (__pyx_v_mslice->suboffsets[__pyx_v_i]) = -1L;
19249 __Pyx_WriteUnraisable(
"View.MemoryView.broadcast_leading", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19251 __Pyx_TraceReturn(Py_None, 1);
19262 static void __pyx_memoryview_refcount_copying(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_dtype_is_object,
int __pyx_v_ndim,
int __pyx_v_inc) {
19263 __Pyx_TraceDeclarations
19265 int __pyx_lineno = 0;
19266 const char *__pyx_filename = NULL;
19267 int __pyx_clineno = 0;
19268 __Pyx_TraceCall(
"refcount_copying", __pyx_f[2], 1364, 1, __PYX_ERR(2, 1364, __pyx_L1_error));
19277 __Pyx_TraceLine(1368,1,__PYX_ERR(2, 1368, __pyx_L1_error))
19278 __pyx_t_1 = (__pyx_v_dtype_is_object != 0);
19288 __Pyx_TraceLine(1369,1,__PYX_ERR(2, 1369, __pyx_L1_error))
19289 __pyx_memoryview_refcount_objects_in_slice_with_gil(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_inc);
19311 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_copying", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19313 __Pyx_TraceReturn(Py_None, 1);
19324 static void __pyx_memoryview_refcount_objects_in_slice_with_gil(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19325 __Pyx_TraceDeclarations
19326 __Pyx_RefNannyDeclarations
19327 int __pyx_lineno = 0;
19328 const char *__pyx_filename = NULL;
19329 int __pyx_clineno = 0;
19331 PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure();
19333 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice_with_gil", 0);
19334 __Pyx_TraceCall(
"refcount_objects_in_slice_with_gil", __pyx_f[2], 1373, 0, __PYX_ERR(2, 1373, __pyx_L1_error));
19343 __Pyx_TraceLine(1376,0,__PYX_ERR(2, 1376, __pyx_L1_error))
19344 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, __pyx_v_shape, __pyx_v_strides, __pyx_v_ndim, __pyx_v_inc);
19357 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice_with_gil", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19359 __Pyx_TraceReturn(Py_None, 0);
19360 __Pyx_RefNannyFinishContext();
19362 __Pyx_PyGILState_Release(__pyx_gilstate_save);
19374 static void __pyx_memoryview_refcount_objects_in_slice(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
int __pyx_v_inc) {
19375 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19376 __Pyx_TraceDeclarations
19377 __Pyx_RefNannyDeclarations
19378 Py_ssize_t __pyx_t_1;
19379 Py_ssize_t __pyx_t_2;
19380 Py_ssize_t __pyx_t_3;
19382 int __pyx_lineno = 0;
19383 const char *__pyx_filename = NULL;
19384 int __pyx_clineno = 0;
19385 __Pyx_RefNannySetupContext(
"refcount_objects_in_slice", 0);
19386 __Pyx_TraceCall(
"refcount_objects_in_slice", __pyx_f[2], 1379, 0, __PYX_ERR(2, 1379, __pyx_L1_error));
19395 __Pyx_TraceLine(1383,0,__PYX_ERR(2, 1383, __pyx_L1_error))
19396 __pyx_t_1 = (__pyx_v_shape[0]);
19397 __pyx_t_2 = __pyx_t_1;
19398 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
19399 __pyx_v_i = __pyx_t_3;
19408 __Pyx_TraceLine(1384,0,__PYX_ERR(2, 1384, __pyx_L1_error))
19409 __pyx_t_4 = ((__pyx_v_ndim == 1) != 0);
19419 __Pyx_TraceLine(1385,0,__PYX_ERR(2, 1385, __pyx_L1_error))
19420 __pyx_t_4 = (__pyx_v_inc != 0);
19430 __Pyx_TraceLine(1386,0,__PYX_ERR(2, 1386, __pyx_L1_error))
19431 Py_INCREF((((PyObject **)__pyx_v_data)[0]));
19450 __Pyx_TraceLine(1388,0,__PYX_ERR(2, 1388, __pyx_L1_error))
19452 Py_DECREF((((PyObject **)__pyx_v_data)[0]));
19473 __Pyx_TraceLine(1390,0,__PYX_ERR(2, 1390, __pyx_L1_error))
19483 __Pyx_TraceLine(1391,0,__PYX_ERR(2, 1391, __pyx_L1_error))
19484 __pyx_memoryview_refcount_objects_in_slice(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_inc);
19495 __Pyx_TraceLine(1393,0,__PYX_ERR(2, 1393, __pyx_L1_error))
19496 __pyx_v_data = (__pyx_v_data + (__pyx_v_strides[0]));
19510 __Pyx_WriteUnraisable(
"View.MemoryView.refcount_objects_in_slice", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0);
19512 __Pyx_TraceReturn(Py_None, 0);
19513 __Pyx_RefNannyFinishContext();
19524 static void __pyx_memoryview_slice_assign_scalar(__Pyx_memviewslice *__pyx_v_dst,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item,
int __pyx_v_dtype_is_object) {
19525 __Pyx_TraceDeclarations
19526 int __pyx_lineno = 0;
19527 const char *__pyx_filename = NULL;
19528 int __pyx_clineno = 0;
19529 __Pyx_TraceCall(
"slice_assign_scalar", __pyx_f[2], 1399, 1, __PYX_ERR(2, 1399, __pyx_L1_error));
19538 __Pyx_TraceLine(1402,1,__PYX_ERR(2, 1402, __pyx_L1_error))
19539 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 0);
19548 __Pyx_TraceLine(1403,1,__PYX_ERR(2, 1403, __pyx_L1_error))
19549 __pyx_memoryview__slice_assign_scalar(__pyx_v_dst->data, __pyx_v_dst->shape, __pyx_v_dst->strides, __pyx_v_ndim, __pyx_v_itemsize, __pyx_v_item);
19558 __Pyx_TraceLine(1405,1,__PYX_ERR(2, 1405, __pyx_L1_error))
19559 __pyx_memoryview_refcount_copying(__pyx_v_dst, __pyx_v_dtype_is_object, __pyx_v_ndim, 1);
19572 __Pyx_WriteUnraisable(
"View.MemoryView.slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19574 __Pyx_TraceReturn(Py_None, 1);
19585 static void __pyx_memoryview__slice_assign_scalar(
char *__pyx_v_data, Py_ssize_t *__pyx_v_shape, Py_ssize_t *__pyx_v_strides,
int __pyx_v_ndim,
size_t __pyx_v_itemsize,
void *__pyx_v_item) {
19586 CYTHON_UNUSED Py_ssize_t __pyx_v_i;
19587 Py_ssize_t __pyx_v_stride;
19588 Py_ssize_t __pyx_v_extent;
19589 __Pyx_TraceDeclarations
19591 Py_ssize_t __pyx_t_2;
19592 Py_ssize_t __pyx_t_3;
19593 Py_ssize_t __pyx_t_4;
19594 int __pyx_lineno = 0;
19595 const char *__pyx_filename = NULL;
19596 int __pyx_clineno = 0;
19597 __Pyx_TraceCall(
"_slice_assign_scalar", __pyx_f[2], 1409, 1, __PYX_ERR(2, 1409, __pyx_L1_error));
19606 __Pyx_TraceLine(1413,1,__PYX_ERR(2, 1413, __pyx_L1_error))
19607 __pyx_v_stride = (__pyx_v_strides[0]);
19616 __Pyx_TraceLine(1414,1,__PYX_ERR(2, 1414, __pyx_L1_error))
19617 __pyx_v_extent = (__pyx_v_shape[0]);
19626 __Pyx_TraceLine(1416,1,__PYX_ERR(2, 1416, __pyx_L1_error))
19627 __pyx_t_1 = ((__pyx_v_ndim == 1) != 0);
19637 __Pyx_TraceLine(1417,1,__PYX_ERR(2, 1417, __pyx_L1_error))
19638 __pyx_t_2 = __pyx_v_extent;
19639 __pyx_t_3 = __pyx_t_2;
19640 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19641 __pyx_v_i = __pyx_t_4;
19650 __Pyx_TraceLine(1418,1,__PYX_ERR(2, 1418, __pyx_L1_error))
19651 (void)(memcpy(__pyx_v_data, __pyx_v_item, __pyx_v_itemsize));
19660 __Pyx_TraceLine(1419,1,__PYX_ERR(2, 1419, __pyx_L1_error))
19661 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19681 __Pyx_TraceLine(1421,1,__PYX_ERR(2, 1421, __pyx_L1_error))
19683 __pyx_t_2 = __pyx_v_extent;
19684 __pyx_t_3 = __pyx_t_2;
19685 for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) {
19686 __pyx_v_i = __pyx_t_4;
19695 __Pyx_TraceLine(1422,1,__PYX_ERR(2, 1422, __pyx_L1_error))
19696 __pyx_memoryview__slice_assign_scalar(__pyx_v_data, (__pyx_v_shape + 1), (__pyx_v_strides + 1), (__pyx_v_ndim - 1), __pyx_v_itemsize, __pyx_v_item);
19705 __Pyx_TraceLine(1424,1,__PYX_ERR(2, 1424, __pyx_L1_error))
19706 __pyx_v_data = (__pyx_v_data + __pyx_v_stride);
19722 __Pyx_WriteUnraisable(
"View.MemoryView._slice_assign_scalar", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 1);
19724 __Pyx_TraceReturn(Py_None, 1);
19734 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds);
19735 static PyMethodDef __pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum = {
"__pyx_unpickle_Enum", (PyCFunction)(
void*)(PyCFunctionWithKeywords)__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum, METH_VARARGS|METH_KEYWORDS, 0};
19736 static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
19737 PyObject *__pyx_v___pyx_type = 0;
19738 long __pyx_v___pyx_checksum;
19739 PyObject *__pyx_v___pyx_state = 0;
19740 int __pyx_lineno = 0;
19741 const char *__pyx_filename = NULL;
19742 int __pyx_clineno = 0;
19743 PyObject *__pyx_r = 0;
19744 __Pyx_RefNannyDeclarations
19745 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum (wrapper)", 0);
19747 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0};
19748 PyObject* values[3] = {0,0,0};
19749 if (unlikely(__pyx_kwds)) {
19750 Py_ssize_t kw_args;
19751 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
19752 switch (pos_args) {
19753 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19754 CYTHON_FALLTHROUGH;
19755 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19756 CYTHON_FALLTHROUGH;
19757 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19758 CYTHON_FALLTHROUGH;
19760 default:
goto __pyx_L5_argtuple_error;
19762 kw_args = PyDict_Size(__pyx_kwds);
19763 switch (pos_args) {
19765 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--;
19766 else goto __pyx_L5_argtuple_error;
19767 CYTHON_FALLTHROUGH;
19769 if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--;
19771 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 1); __PYX_ERR(2, 1, __pyx_L3_error)
19773 CYTHON_FALLTHROUGH;
19775 if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--;
19777 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, 2); __PYX_ERR(2, 1, __pyx_L3_error)
19780 if (unlikely(kw_args > 0)) {
19781 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args,
"__pyx_unpickle_Enum") < 0)) __PYX_ERR(2, 1, __pyx_L3_error)
19783 }
else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
19784 goto __pyx_L5_argtuple_error;
19786 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
19787 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
19788 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
19790 __pyx_v___pyx_type = values[0];
19791 __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]);
if (unlikely((__pyx_v___pyx_checksum == (
long)-1) && PyErr_Occurred())) __PYX_ERR(2, 1, __pyx_L3_error)
19792 __pyx_v___pyx_state = values[2];
19794 goto __pyx_L4_argument_unpacking_done;
19795 __pyx_L5_argtuple_error:;
19796 __Pyx_RaiseArgtupleInvalid(
"__pyx_unpickle_Enum", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(2, 1, __pyx_L3_error)
19798 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19799 __Pyx_RefNannyFinishContext();
19801 __pyx_L4_argument_unpacking_done:;
19802 __pyx_r = __pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state);
19805 __Pyx_RefNannyFinishContext();
19809 static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type,
long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) {
19810 PyObject *__pyx_v___pyx_PickleError = 0;
19811 PyObject *__pyx_v___pyx_result = 0;
19812 PyObject *__pyx_r = NULL;
19813 __Pyx_TraceDeclarations
19814 __Pyx_RefNannyDeclarations
19815 PyObject *__pyx_t_1 = NULL;
19818 PyObject *__pyx_t_4 = NULL;
19819 PyObject *__pyx_t_5 = NULL;
19820 PyObject *__pyx_t_6 = NULL;
19821 int __pyx_lineno = 0;
19822 const char *__pyx_filename = NULL;
19823 int __pyx_clineno = 0;
19824 __Pyx_TraceFrameInit(__pyx_codeobj__21)
19825 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum", 0);
19826 __Pyx_TraceCall(
"__pyx_unpickle_Enum", __pyx_f[2], 1, 0, __PYX_ERR(2, 1, __pyx_L1_error));
19835 __Pyx_TraceLine(4,0,__PYX_ERR(2, 4, __pyx_L1_error))
19836 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
19837 __Pyx_GOTREF(__pyx_t_1);
19838 __pyx_t_2 = (__Pyx_PySequence_ContainsTF(__pyx_t_1, __pyx_tuple__22, Py_NE));
if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(2, 4, __pyx_L1_error)
19839 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19840 __pyx_t_3 = (__pyx_t_2 != 0);
19850 __Pyx_TraceLine(5,0,__PYX_ERR(2, 5, __pyx_L1_error))
19851 __pyx_t_1 = PyList_New(1);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
19852 __Pyx_GOTREF(__pyx_t_1);
19853 __Pyx_INCREF(__pyx_n_s_PickleError);
19854 __Pyx_GIVEREF(__pyx_n_s_PickleError);
19855 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_PickleError);
19856 __pyx_t_4 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_1, 0);
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 5, __pyx_L1_error)
19857 __Pyx_GOTREF(__pyx_t_4);
19858 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19859 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_4, __pyx_n_s_PickleError);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 5, __pyx_L1_error)
19860 __Pyx_GOTREF(__pyx_t_1);
19861 __Pyx_INCREF(__pyx_t_1);
19862 __pyx_v___pyx_PickleError = __pyx_t_1;
19863 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19864 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19873 __Pyx_TraceLine(6,0,__PYX_ERR(2, 6, __pyx_L1_error))
19874 __pyx_t_1 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 6, __pyx_L1_error)
19875 __Pyx_GOTREF(__pyx_t_1);
19876 __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_t_1);
if (unlikely(!__pyx_t_5)) __PYX_ERR(2, 6, __pyx_L1_error)
19877 __Pyx_GOTREF(__pyx_t_5);
19878 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19879 __Pyx_INCREF(__pyx_v___pyx_PickleError);
19880 __pyx_t_1 = __pyx_v___pyx_PickleError; __pyx_t_6 = NULL;
19881 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
19882 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
19883 if (likely(__pyx_t_6)) {
19884 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
19885 __Pyx_INCREF(__pyx_t_6);
19886 __Pyx_INCREF(
function);
19887 __Pyx_DECREF_SET(__pyx_t_1,
function);
19890 __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_6, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5);
19891 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
19892 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
19893 if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 6, __pyx_L1_error)
19894 __Pyx_GOTREF(__pyx_t_4);
19895 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19896 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
19897 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19898 __PYX_ERR(2, 6, __pyx_L1_error)
19916 __Pyx_TraceLine(7,0,__PYX_ERR(2, 7, __pyx_L1_error))
19917 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_MemviewEnum_type), __pyx_n_s_new);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 7, __pyx_L1_error)
19918 __Pyx_GOTREF(__pyx_t_1);
19920 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
19921 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
19922 if (likely(__pyx_t_5)) {
19923 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_1);
19924 __Pyx_INCREF(__pyx_t_5);
19925 __Pyx_INCREF(
function);
19926 __Pyx_DECREF_SET(__pyx_t_1,
function);
19929 __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_5, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v___pyx_type);
19930 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
19931 if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 7, __pyx_L1_error)
19932 __Pyx_GOTREF(__pyx_t_4);
19933 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19934 __pyx_v___pyx_result = __pyx_t_4;
19944 __Pyx_TraceLine(8,0,__PYX_ERR(2, 8, __pyx_L1_error))
19945 __pyx_t_3 = (__pyx_v___pyx_state != Py_None);
19946 __pyx_t_2 = (__pyx_t_3 != 0);
19956 __Pyx_TraceLine(9,0,__PYX_ERR(2, 9, __pyx_L1_error))
19957 if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||((
void)PyErr_Format(PyExc_TypeError,
"Expected %.16s, got %.200s",
"tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(2, 9, __pyx_L1_error)
19958 __pyx_t_4 = __pyx_unpickle_Enum__set_state(((
struct __pyx_MemviewEnum_obj *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state));
if (unlikely(!__pyx_t_4)) __PYX_ERR(2, 9, __pyx_L1_error)
19959 __Pyx_GOTREF(__pyx_t_4);
19960 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
19978 __Pyx_TraceLine(10,0,__PYX_ERR(2, 10, __pyx_L1_error))
19979 __Pyx_XDECREF(__pyx_r);
19980 __Pyx_INCREF(__pyx_v___pyx_result);
19981 __pyx_r = __pyx_v___pyx_result;
19992 __Pyx_XDECREF(__pyx_t_1);
19993 __Pyx_XDECREF(__pyx_t_4);
19994 __Pyx_XDECREF(__pyx_t_5);
19995 __Pyx_XDECREF(__pyx_t_6);
19996 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum", __pyx_clineno, __pyx_lineno, __pyx_filename);
19999 __Pyx_XDECREF(__pyx_v___pyx_PickleError);
20000 __Pyx_XDECREF(__pyx_v___pyx_result);
20001 __Pyx_XGIVEREF(__pyx_r);
20002 __Pyx_TraceReturn(__pyx_r, 0);
20003 __Pyx_RefNannyFinishContext();
20015 static PyObject *__pyx_unpickle_Enum__set_state(
struct __pyx_MemviewEnum_obj *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) {
20016 PyObject *__pyx_r = NULL;
20017 __Pyx_TraceDeclarations
20018 __Pyx_RefNannyDeclarations
20019 PyObject *__pyx_t_1 = NULL;
20021 Py_ssize_t __pyx_t_3;
20024 PyObject *__pyx_t_6 = NULL;
20025 PyObject *__pyx_t_7 = NULL;
20026 PyObject *__pyx_t_8 = NULL;
20027 int __pyx_lineno = 0;
20028 const char *__pyx_filename = NULL;
20029 int __pyx_clineno = 0;
20030 __Pyx_RefNannySetupContext(
"__pyx_unpickle_Enum__set_state", 0);
20031 __Pyx_TraceCall(
"__pyx_unpickle_Enum__set_state", __pyx_f[2], 11, 0, __PYX_ERR(2, 11, __pyx_L1_error));
20040 __Pyx_TraceLine(12,0,__PYX_ERR(2, 12, __pyx_L1_error))
20041 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20042 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20043 __PYX_ERR(2, 12, __pyx_L1_error)
20045 __pyx_t_1 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 12, __pyx_L1_error)
20046 __Pyx_GOTREF(__pyx_t_1);
20047 __Pyx_GIVEREF(__pyx_t_1);
20048 __Pyx_GOTREF(__pyx_v___pyx_result->name);
20049 __Pyx_DECREF(__pyx_v___pyx_result->name);
20050 __pyx_v___pyx_result->name = __pyx_t_1;
20059 __Pyx_TraceLine(13,0,__PYX_ERR(2, 13, __pyx_L1_error))
20060 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20061 PyErr_SetString(PyExc_TypeError,
"object of type 'NoneType' has no len()");
20062 __PYX_ERR(2, 13, __pyx_L1_error)
20064 __pyx_t_3 = PyTuple_GET_SIZE(__pyx_v___pyx_state);
if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20065 __pyx_t_4 = ((__pyx_t_3 > 1) != 0);
20068 __pyx_t_2 = __pyx_t_4;
20069 goto __pyx_L4_bool_binop_done;
20071 __pyx_t_4 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(__pyx_t_4 == ((
int)-1))) __PYX_ERR(2, 13, __pyx_L1_error)
20072 __pyx_t_5 = (__pyx_t_4 != 0);
20073 __pyx_t_2 = __pyx_t_5;
20074 __pyx_L4_bool_binop_done:;
20082 __Pyx_TraceLine(14,0,__PYX_ERR(2, 14, __pyx_L1_error))
20083 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20084 __Pyx_GOTREF(__pyx_t_6);
20085 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update);
if (unlikely(!__pyx_t_7)) __PYX_ERR(2, 14, __pyx_L1_error)
20086 __Pyx_GOTREF(__pyx_t_7);
20087 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20088 if (unlikely(__pyx_v___pyx_state == Py_None)) {
20089 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not subscriptable");
20090 __PYX_ERR(2, 14, __pyx_L1_error)
20092 __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 1,
long, 1, __Pyx_PyInt_From_long, 0, 0, 0);
if (unlikely(!__pyx_t_6)) __PYX_ERR(2, 14, __pyx_L1_error)
20093 __Pyx_GOTREF(__pyx_t_6);
20095 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) {
20096 __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
20097 if (likely(__pyx_t_8)) {
20098 PyObject*
function = PyMethod_GET_FUNCTION(__pyx_t_7);
20099 __Pyx_INCREF(__pyx_t_8);
20100 __Pyx_INCREF(
function);
20101 __Pyx_DECREF_SET(__pyx_t_7,
function);
20104 __pyx_t_1 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6);
20105 __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
20106 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
20107 if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 14, __pyx_L1_error)
20108 __Pyx_GOTREF(__pyx_t_1);
20109 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
20110 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
20129 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
20132 __Pyx_XDECREF(__pyx_t_1);
20133 __Pyx_XDECREF(__pyx_t_6);
20134 __Pyx_XDECREF(__pyx_t_7);
20135 __Pyx_XDECREF(__pyx_t_8);
20136 __Pyx_AddTraceback(
"View.MemoryView.__pyx_unpickle_Enum__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename);
20139 __Pyx_XGIVEREF(__pyx_r);
20140 __Pyx_TraceReturn(__pyx_r, 0);
20141 __Pyx_RefNannyFinishContext();
20144 static struct __pyx_vtabstruct_array __pyx_vtable_array;
20146 static PyObject *__pyx_tp_new_array(PyTypeObject *t, PyObject *a, PyObject *k) {
20147 struct __pyx_array_obj *p;
20149 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20150 o = (*t->tp_alloc)(t, 0);
20152 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20154 if (unlikely(!o))
return 0;
20155 p = ((
struct __pyx_array_obj *)o);
20156 p->__pyx_vtab = __pyx_vtabptr_array;
20157 p->mode = ((PyObject*)Py_None); Py_INCREF(Py_None);
20158 p->_format = ((PyObject*)Py_None); Py_INCREF(Py_None);
20159 if (unlikely(__pyx_array___cinit__(o, a, k) < 0))
goto bad;
20162 Py_DECREF(o); o = 0;
20166 static void __pyx_tp_dealloc_array(PyObject *o) {
20167 struct __pyx_array_obj *p = (
struct __pyx_array_obj *)o;
20168 #if CYTHON_USE_TP_FINALIZE
20169 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !__Pyx_PyObject_GC_IsFinalized(o))) {
20170 if (PyObject_CallFinalizerFromDealloc(o))
return;
20174 PyObject *etype, *eval, *etb;
20175 PyErr_Fetch(&etype, &eval, &etb);
20176 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20177 __pyx_array___dealloc__(o);
20178 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20179 PyErr_Restore(etype, eval, etb);
20182 Py_CLEAR(p->_format);
20183 (*Py_TYPE(o)->tp_free)(o);
20185 static PyObject *__pyx_sq_item_array(PyObject *o, Py_ssize_t i) {
20187 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20188 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20193 static int __pyx_mp_ass_subscript_array(PyObject *o, PyObject *i, PyObject *v) {
20195 return __pyx_array___setitem__(o, i, v);
20198 PyErr_Format(PyExc_NotImplementedError,
20199 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20204 static PyObject *__pyx_tp_getattro_array(PyObject *o, PyObject *n) {
20205 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
20206 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
20208 v = __pyx_array___getattr__(o, n);
20213 static PyObject *__pyx_getprop___pyx_array_memview(PyObject *o, CYTHON_UNUSED
void *x) {
20214 return __pyx_pw_15View_dot_MemoryView_5array_7memview_1__get__(o);
20217 static PyMethodDef __pyx_methods_array[] = {
20218 {
"__getattr__", (PyCFunction)__pyx_array___getattr__, METH_O|METH_COEXIST, 0},
20219 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_array_1__reduce_cython__, METH_NOARGS, 0},
20220 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_array_3__setstate_cython__, METH_O, 0},
20224 static struct PyGetSetDef __pyx_getsets_array[] = {
20225 {(
char *)
"memview", __pyx_getprop___pyx_array_memview, 0, (
char *)0, 0},
20229 static PySequenceMethods __pyx_tp_as_sequence_array = {
20230 __pyx_array___len__,
20233 __pyx_sq_item_array,
20242 static PyMappingMethods __pyx_tp_as_mapping_array = {
20243 __pyx_array___len__,
20244 __pyx_array___getitem__,
20245 __pyx_mp_ass_subscript_array,
20248 static PyBufferProcs __pyx_tp_as_buffer_array = {
20249 #if PY_MAJOR_VERSION < 3
20252 #if PY_MAJOR_VERSION < 3
20255 #if PY_MAJOR_VERSION < 3
20258 #if PY_MAJOR_VERSION < 3
20261 __pyx_array_getbuffer,
20265 static PyTypeObject __pyx_type___pyx_array = {
20266 PyVarObject_HEAD_INIT(0, 0)
20267 "imate._c_trace_estimator.py_c_trace_estimator.array",
20268 sizeof(
struct __pyx_array_obj),
20270 __pyx_tp_dealloc_array,
20271 #
if PY_VERSION_HEX < 0x030800b4
20274 #
if PY_VERSION_HEX >= 0x030800b4
20279 #
if PY_MAJOR_VERSION < 3
20282 #
if PY_MAJOR_VERSION >= 3
20287 &__pyx_tp_as_sequence_array,
20288 &__pyx_tp_as_mapping_array,
20292 __pyx_tp_getattro_array,
20294 &__pyx_tp_as_buffer_array,
20295 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE,
20303 __pyx_methods_array,
20305 __pyx_getsets_array,
20313 __pyx_tp_new_array,
20323 #
if PY_VERSION_HEX >= 0x030400a1
20326 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20329 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20332 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20337 static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
20338 struct __pyx_MemviewEnum_obj *p;
20340 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20341 o = (*t->tp_alloc)(t, 0);
20343 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20345 if (unlikely(!o))
return 0;
20346 p = ((
struct __pyx_MemviewEnum_obj *)o);
20347 p->name = Py_None; Py_INCREF(Py_None);
20351 static void __pyx_tp_dealloc_Enum(PyObject *o) {
20352 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20353 #if CYTHON_USE_TP_FINALIZE
20354 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20355 if (PyObject_CallFinalizerFromDealloc(o))
return;
20358 PyObject_GC_UnTrack(o);
20360 (*Py_TYPE(o)->tp_free)(o);
20363 static int __pyx_tp_traverse_Enum(PyObject *o, visitproc v,
void *a) {
20365 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20367 e = (*v)(p->name, a);
if (e)
return e;
20372 static int __pyx_tp_clear_Enum(PyObject *o) {
20374 struct __pyx_MemviewEnum_obj *p = (
struct __pyx_MemviewEnum_obj *)o;
20375 tmp = ((PyObject*)p->name);
20376 p->name = Py_None; Py_INCREF(Py_None);
20381 static PyMethodDef __pyx_methods_Enum[] = {
20382 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_1__reduce_cython__, METH_NOARGS, 0},
20383 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_MemviewEnum_3__setstate_cython__, METH_O, 0},
20387 static PyTypeObject __pyx_type___pyx_MemviewEnum = {
20388 PyVarObject_HEAD_INIT(0, 0)
20389 "imate._c_trace_estimator.py_c_trace_estimator.Enum",
20390 sizeof(
struct __pyx_MemviewEnum_obj),
20392 __pyx_tp_dealloc_Enum,
20393 #
if PY_VERSION_HEX < 0x030800b4
20396 #
if PY_VERSION_HEX >= 0x030800b4
20401 #
if PY_MAJOR_VERSION < 3
20404 #
if PY_MAJOR_VERSION >= 3
20407 __pyx_MemviewEnum___repr__,
20417 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20419 __pyx_tp_traverse_Enum,
20420 __pyx_tp_clear_Enum,
20425 __pyx_methods_Enum,
20433 __pyx_MemviewEnum___init__,
20445 #
if PY_VERSION_HEX >= 0x030400a1
20448 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20451 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20454 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20458 static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview;
20460 static PyObject *__pyx_tp_new_memoryview(PyTypeObject *t, PyObject *a, PyObject *k) {
20461 struct __pyx_memoryview_obj *p;
20463 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
20464 o = (*t->tp_alloc)(t, 0);
20466 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
20468 if (unlikely(!o))
return 0;
20469 p = ((
struct __pyx_memoryview_obj *)o);
20470 p->__pyx_vtab = __pyx_vtabptr_memoryview;
20471 p->obj = Py_None; Py_INCREF(Py_None);
20472 p->_size = Py_None; Py_INCREF(Py_None);
20473 p->_array_interface = Py_None; Py_INCREF(Py_None);
20474 p->view.obj = NULL;
20475 if (unlikely(__pyx_memoryview___cinit__(o, a, k) < 0))
goto bad;
20478 Py_DECREF(o); o = 0;
20482 static void __pyx_tp_dealloc_memoryview(PyObject *o) {
20483 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20484 #if CYTHON_USE_TP_FINALIZE
20485 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20486 if (PyObject_CallFinalizerFromDealloc(o))
return;
20489 PyObject_GC_UnTrack(o);
20491 PyObject *etype, *eval, *etb;
20492 PyErr_Fetch(&etype, &eval, &etb);
20493 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20494 __pyx_memoryview___dealloc__(o);
20495 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20496 PyErr_Restore(etype, eval, etb);
20499 Py_CLEAR(p->_size);
20500 Py_CLEAR(p->_array_interface);
20501 (*Py_TYPE(o)->tp_free)(o);
20504 static int __pyx_tp_traverse_memoryview(PyObject *o, visitproc v,
void *a) {
20506 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20508 e = (*v)(p->obj, a);
if (e)
return e;
20511 e = (*v)(p->_size, a);
if (e)
return e;
20513 if (p->_array_interface) {
20514 e = (*v)(p->_array_interface, a);
if (e)
return e;
20517 e = (*v)(p->view.obj, a);
if (e)
return e;
20522 static int __pyx_tp_clear_memoryview(PyObject *o) {
20524 struct __pyx_memoryview_obj *p = (
struct __pyx_memoryview_obj *)o;
20525 tmp = ((PyObject*)p->obj);
20526 p->obj = Py_None; Py_INCREF(Py_None);
20528 tmp = ((PyObject*)p->_size);
20529 p->_size = Py_None; Py_INCREF(Py_None);
20531 tmp = ((PyObject*)p->_array_interface);
20532 p->_array_interface = Py_None; Py_INCREF(Py_None);
20534 Py_CLEAR(p->view.obj);
20537 static PyObject *__pyx_sq_item_memoryview(PyObject *o, Py_ssize_t i) {
20539 PyObject *x = PyInt_FromSsize_t(i);
if(!x)
return 0;
20540 r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x);
20545 static int __pyx_mp_ass_subscript_memoryview(PyObject *o, PyObject *i, PyObject *v) {
20547 return __pyx_memoryview___setitem__(o, i, v);
20550 PyErr_Format(PyExc_NotImplementedError,
20551 "Subscript deletion not supported by %.200s", Py_TYPE(o)->tp_name);
20556 static PyObject *__pyx_getprop___pyx_memoryview_T(PyObject *o, CYTHON_UNUSED
void *x) {
20557 return __pyx_pw_15View_dot_MemoryView_10memoryview_1T_1__get__(o);
20560 static PyObject *__pyx_getprop___pyx_memoryview_base(PyObject *o, CYTHON_UNUSED
void *x) {
20561 return __pyx_pw_15View_dot_MemoryView_10memoryview_4base_1__get__(o);
20564 static PyObject *__pyx_getprop___pyx_memoryview_shape(PyObject *o, CYTHON_UNUSED
void *x) {
20565 return __pyx_pw_15View_dot_MemoryView_10memoryview_5shape_1__get__(o);
20568 static PyObject *__pyx_getprop___pyx_memoryview_strides(PyObject *o, CYTHON_UNUSED
void *x) {
20569 return __pyx_pw_15View_dot_MemoryView_10memoryview_7strides_1__get__(o);
20572 static PyObject *__pyx_getprop___pyx_memoryview_suboffsets(PyObject *o, CYTHON_UNUSED
void *x) {
20573 return __pyx_pw_15View_dot_MemoryView_10memoryview_10suboffsets_1__get__(o);
20576 static PyObject *__pyx_getprop___pyx_memoryview_ndim(PyObject *o, CYTHON_UNUSED
void *x) {
20577 return __pyx_pw_15View_dot_MemoryView_10memoryview_4ndim_1__get__(o);
20580 static PyObject *__pyx_getprop___pyx_memoryview_itemsize(PyObject *o, CYTHON_UNUSED
void *x) {
20581 return __pyx_pw_15View_dot_MemoryView_10memoryview_8itemsize_1__get__(o);
20584 static PyObject *__pyx_getprop___pyx_memoryview_nbytes(PyObject *o, CYTHON_UNUSED
void *x) {
20585 return __pyx_pw_15View_dot_MemoryView_10memoryview_6nbytes_1__get__(o);
20588 static PyObject *__pyx_getprop___pyx_memoryview_size(PyObject *o, CYTHON_UNUSED
void *x) {
20589 return __pyx_pw_15View_dot_MemoryView_10memoryview_4size_1__get__(o);
20592 static PyMethodDef __pyx_methods_memoryview[] = {
20593 {
"is_c_contig", (PyCFunction)__pyx_memoryview_is_c_contig, METH_NOARGS, 0},
20594 {
"is_f_contig", (PyCFunction)__pyx_memoryview_is_f_contig, METH_NOARGS, 0},
20595 {
"copy", (PyCFunction)__pyx_memoryview_copy, METH_NOARGS, 0},
20596 {
"copy_fortran", (PyCFunction)__pyx_memoryview_copy_fortran, METH_NOARGS, 0},
20597 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_1__reduce_cython__, METH_NOARGS, 0},
20598 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryview_3__setstate_cython__, METH_O, 0},
20602 static struct PyGetSetDef __pyx_getsets_memoryview[] = {
20603 {(
char *)
"T", __pyx_getprop___pyx_memoryview_T, 0, (
char *)0, 0},
20604 {(
char *)
"base", __pyx_getprop___pyx_memoryview_base, 0, (
char *)0, 0},
20605 {(
char *)
"shape", __pyx_getprop___pyx_memoryview_shape, 0, (
char *)0, 0},
20606 {(
char *)
"strides", __pyx_getprop___pyx_memoryview_strides, 0, (
char *)0, 0},
20607 {(
char *)
"suboffsets", __pyx_getprop___pyx_memoryview_suboffsets, 0, (
char *)0, 0},
20608 {(
char *)
"ndim", __pyx_getprop___pyx_memoryview_ndim, 0, (
char *)0, 0},
20609 {(
char *)
"itemsize", __pyx_getprop___pyx_memoryview_itemsize, 0, (
char *)0, 0},
20610 {(
char *)
"nbytes", __pyx_getprop___pyx_memoryview_nbytes, 0, (
char *)0, 0},
20611 {(
char *)
"size", __pyx_getprop___pyx_memoryview_size, 0, (
char *)0, 0},
20615 static PySequenceMethods __pyx_tp_as_sequence_memoryview = {
20616 __pyx_memoryview___len__,
20619 __pyx_sq_item_memoryview,
20628 static PyMappingMethods __pyx_tp_as_mapping_memoryview = {
20629 __pyx_memoryview___len__,
20630 __pyx_memoryview___getitem__,
20631 __pyx_mp_ass_subscript_memoryview,
20634 static PyBufferProcs __pyx_tp_as_buffer_memoryview = {
20635 #if PY_MAJOR_VERSION < 3
20638 #if PY_MAJOR_VERSION < 3
20641 #if PY_MAJOR_VERSION < 3
20644 #if PY_MAJOR_VERSION < 3
20647 __pyx_memoryview_getbuffer,
20651 static PyTypeObject __pyx_type___pyx_memoryview = {
20652 PyVarObject_HEAD_INIT(0, 0)
20653 "imate._c_trace_estimator.py_c_trace_estimator.memoryview",
20654 sizeof(
struct __pyx_memoryview_obj),
20656 __pyx_tp_dealloc_memoryview,
20657 #
if PY_VERSION_HEX < 0x030800b4
20660 #
if PY_VERSION_HEX >= 0x030800b4
20665 #
if PY_MAJOR_VERSION < 3
20668 #
if PY_MAJOR_VERSION >= 3
20671 __pyx_memoryview___repr__,
20673 &__pyx_tp_as_sequence_memoryview,
20674 &__pyx_tp_as_mapping_memoryview,
20677 __pyx_memoryview___str__,
20680 &__pyx_tp_as_buffer_memoryview,
20681 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20683 __pyx_tp_traverse_memoryview,
20684 __pyx_tp_clear_memoryview,
20689 __pyx_methods_memoryview,
20691 __pyx_getsets_memoryview,
20699 __pyx_tp_new_memoryview,
20709 #
if PY_VERSION_HEX >= 0x030400a1
20712 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20715 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20718 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20722 static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice;
20724 static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyObject *k) {
20725 struct __pyx_memoryviewslice_obj *p;
20726 PyObject *o = __pyx_tp_new_memoryview(t, a, k);
20727 if (unlikely(!o))
return 0;
20728 p = ((
struct __pyx_memoryviewslice_obj *)o);
20729 p->__pyx_base.__pyx_vtab = (
struct __pyx_vtabstruct_memoryview*)__pyx_vtabptr__memoryviewslice;
20730 p->from_object = Py_None; Py_INCREF(Py_None);
20731 p->from_slice.memview = NULL;
20735 static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) {
20736 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20737 #if CYTHON_USE_TP_FINALIZE
20738 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !__Pyx_PyObject_GC_IsFinalized(o)) {
20739 if (PyObject_CallFinalizerFromDealloc(o))
return;
20742 PyObject_GC_UnTrack(o);
20744 PyObject *etype, *eval, *etb;
20745 PyErr_Fetch(&etype, &eval, &etb);
20746 __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1);
20747 __pyx_memoryviewslice___dealloc__(o);
20748 __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1);
20749 PyErr_Restore(etype, eval, etb);
20751 Py_CLEAR(p->from_object);
20752 PyObject_GC_Track(o);
20753 __pyx_tp_dealloc_memoryview(o);
20756 static int __pyx_tp_traverse__memoryviewslice(PyObject *o, visitproc v,
void *a) {
20758 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20759 e = __pyx_tp_traverse_memoryview(o, v, a);
if (e)
return e;
20760 if (p->from_object) {
20761 e = (*v)(p->from_object, a);
if (e)
return e;
20766 static int __pyx_tp_clear__memoryviewslice(PyObject *o) {
20768 struct __pyx_memoryviewslice_obj *p = (
struct __pyx_memoryviewslice_obj *)o;
20769 __pyx_tp_clear_memoryview(o);
20770 tmp = ((PyObject*)p->from_object);
20771 p->from_object = Py_None; Py_INCREF(Py_None);
20773 __PYX_XDEC_MEMVIEW(&p->from_slice, 1);
20777 static PyObject *__pyx_getprop___pyx_memoryviewslice_base(PyObject *o, CYTHON_UNUSED
void *x) {
20778 return __pyx_pw_15View_dot_MemoryView_16_memoryviewslice_4base_1__get__(o);
20781 static PyMethodDef __pyx_methods__memoryviewslice[] = {
20782 {
"__reduce_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_1__reduce_cython__, METH_NOARGS, 0},
20783 {
"__setstate_cython__", (PyCFunction)__pyx_pw___pyx_memoryviewslice_3__setstate_cython__, METH_O, 0},
20787 static struct PyGetSetDef __pyx_getsets__memoryviewslice[] = {
20788 {(
char *)
"base", __pyx_getprop___pyx_memoryviewslice_base, 0, (
char *)0, 0},
20792 static PyTypeObject __pyx_type___pyx_memoryviewslice = {
20793 PyVarObject_HEAD_INIT(0, 0)
20794 "imate._c_trace_estimator.py_c_trace_estimator._memoryviewslice",
20795 sizeof(
struct __pyx_memoryviewslice_obj),
20797 __pyx_tp_dealloc__memoryviewslice,
20798 #
if PY_VERSION_HEX < 0x030800b4
20801 #
if PY_VERSION_HEX >= 0x030800b4
20806 #
if PY_MAJOR_VERSION < 3
20809 #
if PY_MAJOR_VERSION >= 3
20812 #
if CYTHON_COMPILING_IN_PYPY
20813 __pyx_memoryview___repr__,
20822 #
if CYTHON_COMPILING_IN_PYPY
20823 __pyx_memoryview___str__,
20830 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC,
20831 "Internal class for passing memoryview slices to Python",
20832 __pyx_tp_traverse__memoryviewslice,
20833 __pyx_tp_clear__memoryviewslice,
20838 __pyx_methods__memoryviewslice,
20840 __pyx_getsets__memoryviewslice,
20848 __pyx_tp_new__memoryviewslice,
20858 #
if PY_VERSION_HEX >= 0x030400a1
20861 #
if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
20864 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
20867 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
20872 static PyMethodDef __pyx_methods[] = {
20876 #if PY_MAJOR_VERSION >= 3
20877 #if CYTHON_PEP489_MULTI_PHASE_INIT
20878 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def);
20879 static int __pyx_pymod_exec_py_c_trace_estimator(PyObject* module);
20880 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
20881 {Py_mod_create, (
void*)__pyx_pymod_create},
20882 {Py_mod_exec, (
void*)__pyx_pymod_exec_py_c_trace_estimator},
20887 static struct PyModuleDef __pyx_moduledef = {
20888 PyModuleDef_HEAD_INIT,
20889 "py_c_trace_estimator",
20891 #if CYTHON_PEP489_MULTI_PHASE_INIT
20897 #if CYTHON_PEP489_MULTI_PHASE_INIT
20898 __pyx_moduledef_slots,
20907 #ifndef CYTHON_SMALL_CODE
20908 #if defined(__clang__)
20909 #define CYTHON_SMALL_CODE
20910 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
20911 #define CYTHON_SMALL_CODE __attribute__((cold))
20913 #define CYTHON_SMALL_CODE
20917 static __Pyx_StringTabEntry __pyx_string_tab[] = {
20918 {&__pyx_n_s_ASCII, __pyx_k_ASCII,
sizeof(__pyx_k_ASCII), 0, 0, 1, 1},
20919 {&__pyx_n_s_Aop, __pyx_k_Aop,
sizeof(__pyx_k_Aop), 0, 0, 1, 1},
20920 {&__pyx_kp_s_Buffer_view_does_not_expose_stri, __pyx_k_Buffer_view_does_not_expose_stri,
sizeof(__pyx_k_Buffer_view_does_not_expose_stri), 0, 0, 1, 0},
20921 {&__pyx_kp_s_Can_only_create_a_buffer_that_is, __pyx_k_Can_only_create_a_buffer_that_is,
sizeof(__pyx_k_Can_only_create_a_buffer_that_is), 0, 0, 1, 0},
20922 {&__pyx_kp_s_Cannot_assign_to_read_only_memor, __pyx_k_Cannot_assign_to_read_only_memor,
sizeof(__pyx_k_Cannot_assign_to_read_only_memor), 0, 0, 1, 0},
20923 {&__pyx_kp_s_Cannot_create_writable_memory_vi, __pyx_k_Cannot_create_writable_memory_vi,
sizeof(__pyx_k_Cannot_create_writable_memory_vi), 0, 0, 1, 0},
20924 {&__pyx_kp_s_Cannot_index_with_type_s, __pyx_k_Cannot_index_with_type_s,
sizeof(__pyx_k_Cannot_index_with_type_s), 0, 0, 1, 0},
20925 {&__pyx_kp_u_Data_type_should_be_float32_floa, __pyx_k_Data_type_should_be_float32_floa,
sizeof(__pyx_k_Data_type_should_be_float32_floa), 0, 1, 0, 0},
20926 {&__pyx_n_s_Ellipsis, __pyx_k_Ellipsis,
sizeof(__pyx_k_Ellipsis), 0, 0, 1, 1},
20927 {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr,
sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0},
20928 {&__pyx_kp_s_Incompatible_checksums_0x_x_vs_0, __pyx_k_Incompatible_checksums_0x_x_vs_0,
sizeof(__pyx_k_Incompatible_checksums_0x_x_vs_0), 0, 0, 1, 0},
20929 {&__pyx_n_s_IndexError, __pyx_k_IndexError,
sizeof(__pyx_k_IndexError), 0, 0, 1, 1},
20930 {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte,
sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0},
20931 {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr,
sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0},
20932 {&__pyx_kp_s_Invalid_shape_in_axis_d_d, __pyx_k_Invalid_shape_in_axis_d_d,
sizeof(__pyx_k_Invalid_shape_in_axis_d_d), 0, 0, 1, 0},
20933 {&__pyx_n_s_MemoryError, __pyx_k_MemoryError,
sizeof(__pyx_k_MemoryError), 0, 0, 1, 1},
20934 {&__pyx_kp_s_MemoryView_of_r_at_0x_x, __pyx_k_MemoryView_of_r_at_0x_x,
sizeof(__pyx_k_MemoryView_of_r_at_0x_x), 0, 0, 1, 0},
20935 {&__pyx_kp_s_MemoryView_of_r_object, __pyx_k_MemoryView_of_r_object,
sizeof(__pyx_k_MemoryView_of_r_object), 0, 0, 1, 0},
20936 {&__pyx_n_b_O, __pyx_k_O,
sizeof(__pyx_k_O), 0, 0, 0, 1},
20937 {&__pyx_kp_s_Out_of_bounds_on_buffer_access_a, __pyx_k_Out_of_bounds_on_buffer_access_a,
sizeof(__pyx_k_Out_of_bounds_on_buffer_access_a), 0, 0, 1, 0},
20938 {&__pyx_n_s_PickleError, __pyx_k_PickleError,
sizeof(__pyx_k_PickleError), 0, 0, 1, 1},
20939 {&__pyx_n_s_TypeError, __pyx_k_TypeError,
sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
20940 {&__pyx_kp_s_Unable_to_convert_item_to_object, __pyx_k_Unable_to_convert_item_to_object,
sizeof(__pyx_k_Unable_to_convert_item_to_object), 0, 0, 1, 0},
20941 {&__pyx_n_s_ValueError, __pyx_k_ValueError,
sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
20942 {&__pyx_n_s_View_MemoryView, __pyx_k_View_MemoryView,
sizeof(__pyx_k_View_MemoryView), 0, 0, 1, 1},
20943 {&__pyx_n_s_alg_wall_times, __pyx_k_alg_wall_times,
sizeof(__pyx_k_alg_wall_times), 0, 0, 1, 1},
20944 {&__pyx_n_s_allocate_buffer, __pyx_k_allocate_buffer,
sizeof(__pyx_k_allocate_buffer), 0, 0, 1, 1},
20945 {&__pyx_n_s_base, __pyx_k_base,
sizeof(__pyx_k_base), 0, 0, 1, 1},
20946 {&__pyx_n_s_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 0, 1, 1},
20947 {&__pyx_n_u_c, __pyx_k_c,
sizeof(__pyx_k_c), 0, 1, 0, 1},
20948 {&__pyx_n_s_class, __pyx_k_class,
sizeof(__pyx_k_class), 0, 0, 1, 1},
20949 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback,
sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
20950 {&__pyx_n_s_confidence_level, __pyx_k_confidence_level,
sizeof(__pyx_k_confidence_level), 0, 0, 1, 1},
20951 {&__pyx_kp_s_contiguous_and_direct, __pyx_k_contiguous_and_direct,
sizeof(__pyx_k_contiguous_and_direct), 0, 0, 1, 0},
20952 {&__pyx_kp_s_contiguous_and_indirect, __pyx_k_contiguous_and_indirect,
sizeof(__pyx_k_contiguous_and_indirect), 0, 0, 1, 0},
20953 {&__pyx_n_s_converged, __pyx_k_converged,
sizeof(__pyx_k_converged), 0, 0, 1, 1},
20954 {&__pyx_n_s_data_type_name, __pyx_k_data_type_name,
sizeof(__pyx_k_data_type_name), 0, 0, 1, 1},
20955 {&__pyx_n_s_dict, __pyx_k_dict,
sizeof(__pyx_k_dict), 0, 0, 1, 1},
20956 {&__pyx_n_s_dtype_is_object, __pyx_k_dtype_is_object,
sizeof(__pyx_k_dtype_is_object), 0, 0, 1, 1},
20957 {&__pyx_n_s_encode, __pyx_k_encode,
sizeof(__pyx_k_encode), 0, 0, 1, 1},
20958 {&__pyx_n_s_enumerate, __pyx_k_enumerate,
sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
20959 {&__pyx_n_s_error, __pyx_k_error,
sizeof(__pyx_k_error), 0, 0, 1, 1},
20960 {&__pyx_n_s_error_atol, __pyx_k_error_atol,
sizeof(__pyx_k_error_atol), 0, 0, 1, 1},
20961 {&__pyx_n_s_error_rtol, __pyx_k_error_rtol,
sizeof(__pyx_k_error_rtol), 0, 0, 1, 1},
20962 {&__pyx_n_s_exponent, __pyx_k_exponent,
sizeof(__pyx_k_exponent), 0, 0, 1, 1},
20963 {&__pyx_n_s_flags, __pyx_k_flags,
sizeof(__pyx_k_flags), 0, 0, 1, 1},
20964 {&__pyx_n_b_float128, __pyx_k_float128,
sizeof(__pyx_k_float128), 0, 0, 0, 1},
20965 {&__pyx_n_b_float32, __pyx_k_float32,
sizeof(__pyx_k_float32), 0, 0, 0, 1},
20966 {&__pyx_n_b_float64, __pyx_k_float64,
sizeof(__pyx_k_float64), 0, 0, 0, 1},
20967 {&__pyx_n_s_format, __pyx_k_format,
sizeof(__pyx_k_format), 0, 0, 1, 1},
20968 {&__pyx_n_s_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 0, 1, 1},
20969 {&__pyx_n_u_fortran, __pyx_k_fortran,
sizeof(__pyx_k_fortran), 0, 1, 0, 1},
20970 {&__pyx_n_s_getstate, __pyx_k_getstate,
sizeof(__pyx_k_getstate), 0, 0, 1, 1},
20971 {&__pyx_kp_s_got_differing_extents_in_dimensi, __pyx_k_got_differing_extents_in_dimensi,
sizeof(__pyx_k_got_differing_extents_in_dimensi), 0, 0, 1, 0},
20972 {&__pyx_n_s_id, __pyx_k_id,
sizeof(__pyx_k_id), 0, 0, 1, 1},
20973 {&__pyx_kp_s_imate__c_trace_estimator_py_c_tr, __pyx_k_imate__c_trace_estimator_py_c_tr,
sizeof(__pyx_k_imate__c_trace_estimator_py_c_tr), 0, 0, 1, 0},
20974 {&__pyx_n_s_imate__c_trace_estimator_py_c_tr_2, __pyx_k_imate__c_trace_estimator_py_c_tr_2,
sizeof(__pyx_k_imate__c_trace_estimator_py_c_tr_2), 0, 0, 1, 1},
20975 {&__pyx_n_s_import, __pyx_k_import,
sizeof(__pyx_k_import), 0, 0, 1, 1},
20976 {&__pyx_n_s_isscalar, __pyx_k_isscalar,
sizeof(__pyx_k_isscalar), 0, 0, 1, 1},
20977 {&__pyx_n_s_itemsize, __pyx_k_itemsize,
sizeof(__pyx_k_itemsize), 0, 0, 1, 1},
20978 {&__pyx_kp_s_itemsize_0_for_cython_array, __pyx_k_itemsize_0_for_cython_array,
sizeof(__pyx_k_itemsize_0_for_cython_array), 0, 0, 1, 0},
20979 {&__pyx_n_s_lanczos_degree, __pyx_k_lanczos_degree,
sizeof(__pyx_k_lanczos_degree), 0, 0, 1, 1},
20980 {&__pyx_n_s_lanczos_tol, __pyx_k_lanczos_tol,
sizeof(__pyx_k_lanczos_tol), 0, 0, 1, 1},
20981 {&__pyx_n_s_main, __pyx_k_main,
sizeof(__pyx_k_main), 0, 0, 1, 1},
20982 {&__pyx_n_s_max_num_samples, __pyx_k_max_num_samples,
sizeof(__pyx_k_max_num_samples), 0, 0, 1, 1},
20983 {&__pyx_n_s_memview, __pyx_k_memview,
sizeof(__pyx_k_memview), 0, 0, 1, 1},
20984 {&__pyx_n_s_min_num_samples, __pyx_k_min_num_samples,
sizeof(__pyx_k_min_num_samples), 0, 0, 1, 1},
20985 {&__pyx_n_s_mode, __pyx_k_mode,
sizeof(__pyx_k_mode), 0, 0, 1, 1},
20986 {&__pyx_n_s_name, __pyx_k_name,
sizeof(__pyx_k_name), 0, 0, 1, 1},
20987 {&__pyx_n_s_name_2, __pyx_k_name_2,
sizeof(__pyx_k_name_2), 0, 0, 1, 1},
20988 {&__pyx_n_s_ndim, __pyx_k_ndim,
sizeof(__pyx_k_ndim), 0, 0, 1, 1},
20989 {&__pyx_n_s_new, __pyx_k_new,
sizeof(__pyx_k_new), 0, 0, 1, 1},
20990 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non,
sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
20991 {&__pyx_n_s_num_inquiries, __pyx_k_num_inquiries,
sizeof(__pyx_k_num_inquiries), 0, 0, 1, 1},
20992 {&__pyx_n_s_num_outliers, __pyx_k_num_outliers,
sizeof(__pyx_k_num_outliers), 0, 0, 1, 1},
20993 {&__pyx_n_s_num_samples_used, __pyx_k_num_samples_used,
sizeof(__pyx_k_num_samples_used), 0, 0, 1, 1},
20994 {&__pyx_n_s_num_threads, __pyx_k_num_threads,
sizeof(__pyx_k_num_threads), 0, 0, 1, 1},
20995 {&__pyx_n_s_numpy, __pyx_k_numpy,
sizeof(__pyx_k_numpy), 0, 0, 1, 1},
20996 {&__pyx_n_s_obj, __pyx_k_obj,
sizeof(__pyx_k_obj), 0, 0, 1, 1},
20997 {&__pyx_n_s_outlier_significance_level, __pyx_k_outlier_significance_level,
sizeof(__pyx_k_outlier_significance_level), 0, 0, 1, 1},
20998 {&__pyx_n_s_pack, __pyx_k_pack,
sizeof(__pyx_k_pack), 0, 0, 1, 1},
20999 {&__pyx_n_s_parameters, __pyx_k_parameters,
sizeof(__pyx_k_parameters), 0, 0, 1, 1},
21000 {&__pyx_n_s_pickle, __pyx_k_pickle,
sizeof(__pyx_k_pickle), 0, 0, 1, 1},
21001 {&__pyx_n_s_processed_samples_indices, __pyx_k_processed_samples_indices,
sizeof(__pyx_k_processed_samples_indices), 0, 0, 1, 1},
21002 {&__pyx_n_s_py_matrix_function, __pyx_k_py_matrix_function,
sizeof(__pyx_k_py_matrix_function), 0, 0, 1, 1},
21003 {&__pyx_n_s_pyc_trace_estimator, __pyx_k_pyc_trace_estimator,
sizeof(__pyx_k_pyc_trace_estimator), 0, 0, 1, 1},
21004 {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError,
sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1},
21005 {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum,
sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1},
21006 {&__pyx_n_s_pyx_getbuffer, __pyx_k_pyx_getbuffer,
sizeof(__pyx_k_pyx_getbuffer), 0, 0, 1, 1},
21007 {&__pyx_n_s_pyx_result, __pyx_k_pyx_result,
sizeof(__pyx_k_pyx_result), 0, 0, 1, 1},
21008 {&__pyx_n_s_pyx_state, __pyx_k_pyx_state,
sizeof(__pyx_k_pyx_state), 0, 0, 1, 1},
21009 {&__pyx_n_s_pyx_type, __pyx_k_pyx_type,
sizeof(__pyx_k_pyx_type), 0, 0, 1, 1},
21010 {&__pyx_n_s_pyx_unpickle_Enum, __pyx_k_pyx_unpickle_Enum,
sizeof(__pyx_k_pyx_unpickle_Enum), 0, 0, 1, 1},
21011 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable,
sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
21012 {&__pyx_n_s_range, __pyx_k_range,
sizeof(__pyx_k_range), 0, 0, 1, 1},
21013 {&__pyx_n_s_reduce, __pyx_k_reduce,
sizeof(__pyx_k_reduce), 0, 0, 1, 1},
21014 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython,
sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
21015 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex,
sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
21016 {&__pyx_n_s_reorthogonalize, __pyx_k_reorthogonalize,
sizeof(__pyx_k_reorthogonalize), 0, 0, 1, 1},
21017 {&__pyx_n_s_samples, __pyx_k_samples,
sizeof(__pyx_k_samples), 0, 0, 1, 1},
21018 {&__pyx_n_s_setstate, __pyx_k_setstate,
sizeof(__pyx_k_setstate), 0, 0, 1, 1},
21019 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython,
sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
21020 {&__pyx_n_s_shape, __pyx_k_shape,
sizeof(__pyx_k_shape), 0, 0, 1, 1},
21021 {&__pyx_n_s_size, __pyx_k_size,
sizeof(__pyx_k_size), 0, 0, 1, 1},
21022 {&__pyx_n_s_start, __pyx_k_start,
sizeof(__pyx_k_start), 0, 0, 1, 1},
21023 {&__pyx_n_s_step, __pyx_k_step,
sizeof(__pyx_k_step), 0, 0, 1, 1},
21024 {&__pyx_n_s_stop, __pyx_k_stop,
sizeof(__pyx_k_stop), 0, 0, 1, 1},
21025 {&__pyx_kp_s_strided_and_direct, __pyx_k_strided_and_direct,
sizeof(__pyx_k_strided_and_direct), 0, 0, 1, 0},
21026 {&__pyx_kp_s_strided_and_direct_or_indirect, __pyx_k_strided_and_direct_or_indirect,
sizeof(__pyx_k_strided_and_direct_or_indirect), 0, 0, 1, 0},
21027 {&__pyx_kp_s_strided_and_indirect, __pyx_k_strided_and_indirect,
sizeof(__pyx_k_strided_and_indirect), 0, 0, 1, 0},
21028 {&__pyx_kp_s_stringsource, __pyx_k_stringsource,
sizeof(__pyx_k_stringsource), 0, 0, 1, 0},
21029 {&__pyx_n_s_struct, __pyx_k_struct,
sizeof(__pyx_k_struct), 0, 0, 1, 1},
21030 {&__pyx_n_s_symmetric, __pyx_k_symmetric,
sizeof(__pyx_k_symmetric), 0, 0, 1, 1},
21031 {&__pyx_n_s_test, __pyx_k_test,
sizeof(__pyx_k_test), 0, 0, 1, 1},
21032 {&__pyx_n_s_trace, __pyx_k_trace,
sizeof(__pyx_k_trace), 0, 0, 1, 1},
21033 {&__pyx_kp_s_unable_to_allocate_array_data, __pyx_k_unable_to_allocate_array_data,
sizeof(__pyx_k_unable_to_allocate_array_data), 0, 0, 1, 0},
21034 {&__pyx_kp_s_unable_to_allocate_shape_and_str, __pyx_k_unable_to_allocate_shape_and_str,
sizeof(__pyx_k_unable_to_allocate_shape_and_str), 0, 0, 1, 0},
21035 {&__pyx_n_s_unpack, __pyx_k_unpack,
sizeof(__pyx_k_unpack), 0, 0, 1, 1},
21036 {&__pyx_n_s_update, __pyx_k_update,
sizeof(__pyx_k_update), 0, 0, 1, 1},
21037 {0, 0, 0, 0, 0, 0, 0}
21039 static CYTHON_SMALL_CODE
int __Pyx_InitCachedBuiltins(
void) {
21040 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError);
if (!__pyx_builtin_TypeError) __PYX_ERR(0, 155, __pyx_L1_error)
21041 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range);
if (!__pyx_builtin_range) __PYX_ERR(0, 224, __pyx_L1_error)
21042 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError);
if (!__pyx_builtin_ValueError) __PYX_ERR(2, 134, __pyx_L1_error)
21043 __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError);
if (!__pyx_builtin_MemoryError) __PYX_ERR(2, 149, __pyx_L1_error)
21044 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate);
if (!__pyx_builtin_enumerate) __PYX_ERR(2, 152, __pyx_L1_error)
21045 __pyx_builtin_Ellipsis = __Pyx_GetBuiltinName(__pyx_n_s_Ellipsis);
if (!__pyx_builtin_Ellipsis) __PYX_ERR(2, 406, __pyx_L1_error)
21046 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id);
if (!__pyx_builtin_id) __PYX_ERR(2, 615, __pyx_L1_error)
21047 __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s_IndexError);
if (!__pyx_builtin_IndexError) __PYX_ERR(2, 834, __pyx_L1_error)
21053 static CYTHON_SMALL_CODE
int __Pyx_InitCachedConstants(
void) {
21054 __Pyx_RefNannyDeclarations
21055 __Pyx_RefNannySetupContext(
"__Pyx_InitCachedConstants", 0);
21064 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Data_type_should_be_float32_floa);
if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 155, __pyx_L1_error)
21065 __Pyx_GOTREF(__pyx_tuple__2);
21066 __Pyx_GIVEREF(__pyx_tuple__2);
21075 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Empty_shape_tuple_for_cython_arr);
if (unlikely(!__pyx_tuple__3)) __PYX_ERR(2, 134, __pyx_L1_error)
21076 __Pyx_GOTREF(__pyx_tuple__3);
21077 __Pyx_GIVEREF(__pyx_tuple__3);
21086 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_itemsize_0_for_cython_array);
if (unlikely(!__pyx_tuple__4)) __PYX_ERR(2, 137, __pyx_L1_error)
21087 __Pyx_GOTREF(__pyx_tuple__4);
21088 __Pyx_GIVEREF(__pyx_tuple__4);
21097 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_shape_and_str);
if (unlikely(!__pyx_tuple__5)) __PYX_ERR(2, 149, __pyx_L1_error)
21098 __Pyx_GOTREF(__pyx_tuple__5);
21099 __Pyx_GIVEREF(__pyx_tuple__5);
21108 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unable_to_allocate_array_data);
if (unlikely(!__pyx_tuple__6)) __PYX_ERR(2, 177, __pyx_L1_error)
21109 __Pyx_GOTREF(__pyx_tuple__6);
21110 __Pyx_GIVEREF(__pyx_tuple__6);
21119 __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Can_only_create_a_buffer_that_is);
if (unlikely(!__pyx_tuple__7)) __PYX_ERR(2, 193, __pyx_L1_error)
21120 __Pyx_GOTREF(__pyx_tuple__7);
21121 __Pyx_GIVEREF(__pyx_tuple__7);
21129 __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__8)) __PYX_ERR(2, 2, __pyx_L1_error)
21130 __Pyx_GOTREF(__pyx_tuple__8);
21131 __Pyx_GIVEREF(__pyx_tuple__8);
21138 __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__9)) __PYX_ERR(2, 4, __pyx_L1_error)
21139 __Pyx_GOTREF(__pyx_tuple__9);
21140 __Pyx_GIVEREF(__pyx_tuple__9);
21149 __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Cannot_assign_to_read_only_memor);
if (unlikely(!__pyx_tuple__10)) __PYX_ERR(2, 420, __pyx_L1_error)
21150 __Pyx_GOTREF(__pyx_tuple__10);
21151 __Pyx_GIVEREF(__pyx_tuple__10);
21160 __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Unable_to_convert_item_to_object);
if (unlikely(!__pyx_tuple__11)) __PYX_ERR(2, 497, __pyx_L1_error)
21161 __Pyx_GOTREF(__pyx_tuple__11);
21162 __Pyx_GIVEREF(__pyx_tuple__11);
21171 __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Cannot_create_writable_memory_vi);
if (unlikely(!__pyx_tuple__12)) __PYX_ERR(2, 522, __pyx_L1_error)
21172 __Pyx_GOTREF(__pyx_tuple__12);
21173 __Pyx_GIVEREF(__pyx_tuple__12);
21182 __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Buffer_view_does_not_expose_stri);
if (unlikely(!__pyx_tuple__13)) __PYX_ERR(2, 572, __pyx_L1_error)
21183 __Pyx_GOTREF(__pyx_tuple__13);
21184 __Pyx_GIVEREF(__pyx_tuple__13);
21193 __pyx_tuple__14 = PyTuple_New(1);
if (unlikely(!__pyx_tuple__14)) __PYX_ERR(2, 579, __pyx_L1_error)
21194 __Pyx_GOTREF(__pyx_tuple__14);
21195 __Pyx_INCREF(__pyx_int_neg_1);
21196 __Pyx_GIVEREF(__pyx_int_neg_1);
21197 PyTuple_SET_ITEM(__pyx_tuple__14, 0, __pyx_int_neg_1);
21198 __Pyx_GIVEREF(__pyx_tuple__14);
21206 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__15)) __PYX_ERR(2, 2, __pyx_L1_error)
21207 __Pyx_GOTREF(__pyx_tuple__15);
21208 __Pyx_GIVEREF(__pyx_tuple__15);
21215 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__16)) __PYX_ERR(2, 4, __pyx_L1_error)
21216 __Pyx_GOTREF(__pyx_tuple__16);
21217 __Pyx_GIVEREF(__pyx_tuple__16);
21226 __pyx_slice__17 = PySlice_New(Py_None, Py_None, Py_None);
if (unlikely(!__pyx_slice__17)) __PYX_ERR(2, 684, __pyx_L1_error)
21227 __Pyx_GOTREF(__pyx_slice__17);
21228 __Pyx_GIVEREF(__pyx_slice__17);
21237 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Indirect_dimensions_not_supporte);
if (unlikely(!__pyx_tuple__18)) __PYX_ERR(2, 705, __pyx_L1_error)
21238 __Pyx_GOTREF(__pyx_tuple__18);
21239 __Pyx_GIVEREF(__pyx_tuple__18);
21247 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__19)) __PYX_ERR(2, 2, __pyx_L1_error)
21248 __Pyx_GOTREF(__pyx_tuple__19);
21249 __Pyx_GIVEREF(__pyx_tuple__19);
21256 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non);
if (unlikely(!__pyx_tuple__20)) __PYX_ERR(2, 4, __pyx_L1_error)
21257 __Pyx_GOTREF(__pyx_tuple__20);
21258 __Pyx_GIVEREF(__pyx_tuple__20);
21259 __pyx_tuple__22 = PyTuple_Pack(3, __pyx_int_184977713, __pyx_int_136983863, __pyx_int_112105877);
if (unlikely(!__pyx_tuple__22)) __PYX_ERR(2, 4, __pyx_L1_error)
21260 __Pyx_GOTREF(__pyx_tuple__22);
21261 __Pyx_GIVEREF(__pyx_tuple__22);
21270 __pyx_tuple__23 = PyTuple_Pack(25, __pyx_n_s_Aop, __pyx_n_s_parameters, __pyx_n_s_num_inquiries, __pyx_n_s_py_matrix_function, __pyx_n_s_exponent, __pyx_n_s_symmetric, __pyx_n_s_reorthogonalize, __pyx_n_s_lanczos_degree, __pyx_n_s_lanczos_tol, __pyx_n_s_min_num_samples, __pyx_n_s_max_num_samples, __pyx_n_s_error_atol, __pyx_n_s_error_rtol, __pyx_n_s_confidence_level, __pyx_n_s_outlier_significance_level, __pyx_n_s_num_threads, __pyx_n_s_data_type_name, __pyx_n_s_trace, __pyx_n_s_error, __pyx_n_s_samples, __pyx_n_s_processed_samples_indices, __pyx_n_s_num_samples_used, __pyx_n_s_num_outliers, __pyx_n_s_converged, __pyx_n_s_alg_wall_times);
if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 38, __pyx_L1_error)
21271 __Pyx_GOTREF(__pyx_tuple__23);
21272 __Pyx_GIVEREF(__pyx_tuple__23);
21273 __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(25, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_imate__c_trace_estimator_py_c_tr, __pyx_n_s_pyc_trace_estimator, 38, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 38, __pyx_L1_error)
21282 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct_or_indirect);
if (unlikely(!__pyx_tuple__24)) __PYX_ERR(2, 287, __pyx_L1_error)
21283 __Pyx_GOTREF(__pyx_tuple__24);
21284 __Pyx_GIVEREF(__pyx_tuple__24);
21293 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_strided_and_direct);
if (unlikely(!__pyx_tuple__25)) __PYX_ERR(2, 288, __pyx_L1_error)
21294 __Pyx_GOTREF(__pyx_tuple__25);
21295 __Pyx_GIVEREF(__pyx_tuple__25);
21304 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_strided_and_indirect);
if (unlikely(!__pyx_tuple__26)) __PYX_ERR(2, 289, __pyx_L1_error)
21305 __Pyx_GOTREF(__pyx_tuple__26);
21306 __Pyx_GIVEREF(__pyx_tuple__26);
21315 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_direct);
if (unlikely(!__pyx_tuple__27)) __PYX_ERR(2, 292, __pyx_L1_error)
21316 __Pyx_GOTREF(__pyx_tuple__27);
21317 __Pyx_GIVEREF(__pyx_tuple__27);
21326 __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_contiguous_and_indirect);
if (unlikely(!__pyx_tuple__28)) __PYX_ERR(2, 293, __pyx_L1_error)
21327 __Pyx_GOTREF(__pyx_tuple__28);
21328 __Pyx_GIVEREF(__pyx_tuple__28);
21335 __pyx_tuple__29 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result);
if (unlikely(!__pyx_tuple__29)) __PYX_ERR(2, 1, __pyx_L1_error)
21336 __Pyx_GOTREF(__pyx_tuple__29);
21337 __Pyx_GIVEREF(__pyx_tuple__29);
21338 __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes);
if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(2, 1, __pyx_L1_error)
21339 __Pyx_RefNannyFinishContext();
21342 __Pyx_RefNannyFinishContext();
21346 static CYTHON_SMALL_CODE
int __Pyx_InitGlobals(
void) {
21348 __Pyx_init_assertions_enabled();
21350 if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error)
21352 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21353 __pyx_int_0 = PyInt_FromLong(0);
if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
21354 __pyx_int_1 = PyInt_FromLong(1);
if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21355 __pyx_int_112105877 = PyInt_FromLong(112105877L);
if (unlikely(!__pyx_int_112105877)) __PYX_ERR(0, 1, __pyx_L1_error)
21356 __pyx_int_136983863 = PyInt_FromLong(136983863L);
if (unlikely(!__pyx_int_136983863)) __PYX_ERR(0, 1, __pyx_L1_error)
21357 __pyx_int_184977713 = PyInt_FromLong(184977713L);
if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error)
21358 __pyx_int_neg_1 = PyInt_FromLong(-1);
if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21364 static CYTHON_SMALL_CODE
int __Pyx_modinit_global_init_code(
void);
21365 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_export_code(
void);
21366 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_export_code(
void);
21367 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_init_code(
void);
21368 static CYTHON_SMALL_CODE
int __Pyx_modinit_type_import_code(
void);
21369 static CYTHON_SMALL_CODE
int __Pyx_modinit_variable_import_code(
void);
21370 static CYTHON_SMALL_CODE
int __Pyx_modinit_function_import_code(
void);
21372 static int __Pyx_modinit_global_init_code(
void) {
21373 __Pyx_RefNannyDeclarations
21374 __Pyx_RefNannySetupContext(
"__Pyx_modinit_global_init_code", 0);
21376 generic = Py_None; Py_INCREF(Py_None);
21377 strided = Py_None; Py_INCREF(Py_None);
21378 indirect = Py_None; Py_INCREF(Py_None);
21379 contiguous = Py_None; Py_INCREF(Py_None);
21380 indirect_contiguous = Py_None; Py_INCREF(Py_None);
21381 __Pyx_RefNannyFinishContext();
21385 static int __Pyx_modinit_variable_export_code(
void) {
21386 __Pyx_RefNannyDeclarations
21387 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_export_code", 0);
21389 __Pyx_RefNannyFinishContext();
21393 static int __Pyx_modinit_function_export_code(
void) {
21394 __Pyx_RefNannyDeclarations
21395 int __pyx_lineno = 0;
21396 const char *__pyx_filename = NULL;
21397 int __pyx_clineno = 0;
21398 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_export_code", 0);
21400 if (__Pyx_ExportFunction(
"pyc_trace_estimator", (
void (*)(
void))__pyx_f_5imate_18_c_trace_estimator_20py_c_trace_estimator_pyc_trace_estimator,
"__pyx_t_5imate_12_definitions_5types_FlagType (struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator *, PyObject *, PyObject *, struct __pyx_obj_5imate_9functions_12py_functions_pyFunction *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21401 __Pyx_RefNannyFinishContext();
21404 __Pyx_RefNannyFinishContext();
21408 static int __Pyx_modinit_type_init_code(
void) {
21409 __Pyx_RefNannyDeclarations
21410 int __pyx_lineno = 0;
21411 const char *__pyx_filename = NULL;
21412 int __pyx_clineno = 0;
21413 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_init_code", 0);
21415 __pyx_vtabptr_array = &__pyx_vtable_array;
21416 __pyx_vtable_array.get_memview = (PyObject *(*)(
struct __pyx_array_obj *))__pyx_array_get_memview;
21417 if (PyType_Ready(&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21418 #if PY_VERSION_HEX < 0x030800B1
21419 __pyx_type___pyx_array.tp_print = 0;
21421 if (__Pyx_SetVtable(__pyx_type___pyx_array.tp_dict, __pyx_vtabptr_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21422 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_array) < 0) __PYX_ERR(2, 106, __pyx_L1_error)
21423 __pyx_array_type = &__pyx_type___pyx_array;
21424 if (PyType_Ready(&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
21425 #if PY_VERSION_HEX < 0x030800B1
21426 __pyx_type___pyx_MemviewEnum.tp_print = 0;
21428 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_MemviewEnum.tp_dictoffset && __pyx_type___pyx_MemviewEnum.tp_getattro == PyObject_GenericGetAttr)) {
21429 __pyx_type___pyx_MemviewEnum.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21431 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_MemviewEnum) < 0) __PYX_ERR(2, 280, __pyx_L1_error)
21432 __pyx_MemviewEnum_type = &__pyx_type___pyx_MemviewEnum;
21433 __pyx_vtabptr_memoryview = &__pyx_vtable_memoryview;
21434 __pyx_vtable_memoryview.get_item_pointer = (
char *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_get_item_pointer;
21435 __pyx_vtable_memoryview.is_slice = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_is_slice;
21436 __pyx_vtable_memoryview.setitem_slice_assignment = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_slice_assignment;
21437 __pyx_vtable_memoryview.setitem_slice_assign_scalar = (PyObject *(*)(
struct __pyx_memoryview_obj *,
struct __pyx_memoryview_obj *, PyObject *))__pyx_memoryview_setitem_slice_assign_scalar;
21438 __pyx_vtable_memoryview.setitem_indexed = (PyObject *(*)(
struct __pyx_memoryview_obj *, PyObject *, PyObject *))__pyx_memoryview_setitem_indexed;
21439 __pyx_vtable_memoryview.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryview_convert_item_to_object;
21440 __pyx_vtable_memoryview.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryview_assign_item_from_object;
21441 if (PyType_Ready(&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21442 #if PY_VERSION_HEX < 0x030800B1
21443 __pyx_type___pyx_memoryview.tp_print = 0;
21445 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryview.tp_dictoffset && __pyx_type___pyx_memoryview.tp_getattro == PyObject_GenericGetAttr)) {
21446 __pyx_type___pyx_memoryview.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21448 if (__Pyx_SetVtable(__pyx_type___pyx_memoryview.tp_dict, __pyx_vtabptr_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21449 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryview) < 0) __PYX_ERR(2, 331, __pyx_L1_error)
21450 __pyx_memoryview_type = &__pyx_type___pyx_memoryview;
21451 __pyx_vtabptr__memoryviewslice = &__pyx_vtable__memoryviewslice;
21452 __pyx_vtable__memoryviewslice.__pyx_base = *__pyx_vtabptr_memoryview;
21453 __pyx_vtable__memoryviewslice.__pyx_base.convert_item_to_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *))__pyx_memoryviewslice_convert_item_to_object;
21454 __pyx_vtable__memoryviewslice.__pyx_base.assign_item_from_object = (PyObject *(*)(
struct __pyx_memoryview_obj *,
char *, PyObject *))__pyx_memoryviewslice_assign_item_from_object;
21455 __pyx_type___pyx_memoryviewslice.tp_base = __pyx_memoryview_type;
21456 if (PyType_Ready(&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21457 #if PY_VERSION_HEX < 0x030800B1
21458 __pyx_type___pyx_memoryviewslice.tp_print = 0;
21460 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type___pyx_memoryviewslice.tp_dictoffset && __pyx_type___pyx_memoryviewslice.tp_getattro == PyObject_GenericGetAttr)) {
21461 __pyx_type___pyx_memoryviewslice.tp_getattro = __Pyx_PyObject_GenericGetAttr;
21463 if (__Pyx_SetVtable(__pyx_type___pyx_memoryviewslice.tp_dict, __pyx_vtabptr__memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21464 if (__Pyx_setup_reduce((PyObject*)&__pyx_type___pyx_memoryviewslice) < 0) __PYX_ERR(2, 967, __pyx_L1_error)
21465 __pyx_memoryviewslice_type = &__pyx_type___pyx_memoryviewslice;
21466 __Pyx_RefNannyFinishContext();
21469 __Pyx_RefNannyFinishContext();
21473 static int __Pyx_modinit_type_import_code(
void) {
21474 __Pyx_RefNannyDeclarations
21475 PyObject *__pyx_t_1 = NULL;
21476 int __pyx_lineno = 0;
21477 const char *__pyx_filename = NULL;
21478 int __pyx_clineno = 0;
21479 __Pyx_RefNannySetupContext(
"__Pyx_modinit_type_import_code", 0);
21481 __pyx_t_1 = PyImport_ImportModule(
"imate.functions.py_functions");
if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 20, __pyx_L1_error)
21482 __Pyx_GOTREF(__pyx_t_1);
21483 __pyx_ptype_5imate_9functions_12py_functions_pyFunction = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate.functions.py_functions",
"pyFunction",
sizeof(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_9functions_12py_functions_pyFunction),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_9functions_12py_functions_pyFunction) __PYX_ERR(3, 20, __pyx_L1_error)
21484 __pyx_vtabptr_5imate_9functions_12py_functions_pyFunction = (
struct __pyx_vtabstruct_5imate_9functions_12py_functions_pyFunction*)__Pyx_GetVtable(__pyx_ptype_5imate_9functions_12py_functions_pyFunction->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_9functions_12py_functions_pyFunction)) __PYX_ERR(3, 20, __pyx_L1_error)
21485 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21486 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_linear_operator");
if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 23, __pyx_L1_error)
21487 __Pyx_GOTREF(__pyx_t_1);
21488 __pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_linear_operator",
"pycLinearOperator",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator) __PYX_ERR(4, 23, __pyx_L1_error)
21489 __pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_20py_c_linear_operator_pycLinearOperator)) __PYX_ERR(4, 23, __pyx_L1_error)
21490 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21491 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_matrix");
if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 21, __pyx_L1_error)
21492 __Pyx_GOTREF(__pyx_t_1);
21493 __pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_matrix",
"pycMatrix",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix) __PYX_ERR(5, 21, __pyx_L1_error)
21494 __pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_11py_c_matrix_pycMatrix)) __PYX_ERR(5, 21, __pyx_L1_error)
21495 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21496 __pyx_t_1 = PyImport_ImportModule(
"imate._c_linear_operator.py_c_affine_matrix_function");
if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 21, __pyx_L1_error)
21497 __Pyx_GOTREF(__pyx_t_1);
21498 __pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = __Pyx_ImportType_0_29_36(__pyx_t_1,
"imate._c_linear_operator.py_c_affine_matrix_function",
"pycAffineMatrixFunction",
sizeof(
struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction), __PYX_GET_STRUCT_ALIGNMENT_0_29_36(
struct __pyx_obj_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction),__Pyx_ImportType_CheckSize_Warn_0_29_36);
if (!__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction) __PYX_ERR(6, 21, __pyx_L1_error)
21499 __pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction = (
struct __pyx_vtabstruct_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction*)__Pyx_GetVtable(__pyx_ptype_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction->tp_dict);
if (unlikely(!__pyx_vtabptr_5imate_18_c_linear_operator_27py_c_affine_matrix_function_pycAffineMatrixFunction)) __PYX_ERR(6, 21, __pyx_L1_error)
21500 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21501 __Pyx_RefNannyFinishContext();
21504 __Pyx_XDECREF(__pyx_t_1);
21505 __Pyx_RefNannyFinishContext();
21509 static int __Pyx_modinit_variable_import_code(
void) {
21510 __Pyx_RefNannyDeclarations
21511 __Pyx_RefNannySetupContext(
"__Pyx_modinit_variable_import_code", 0);
21513 __Pyx_RefNannyFinishContext();
21517 static int __Pyx_modinit_function_import_code(
void) {
21518 __Pyx_RefNannyDeclarations
21519 PyObject *__pyx_t_1 = NULL;
21520 int __pyx_lineno = 0;
21521 const char *__pyx_filename = NULL;
21522 int __pyx_clineno = 0;
21523 __Pyx_RefNannySetupContext(
"__Pyx_modinit_function_import_code", 0);
21525 __pyx_t_1 = PyImport_ImportModule(
"scipy.linalg.cython_lapack");
if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
21526 __Pyx_GOTREF(__pyx_t_1);
21527 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"dbdsdc", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_dbdsdc,
"void (char *, char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21528 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"dstev", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_dstev,
"void (char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_d *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21529 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"sbdsdc", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_sbdsdc,
"void (char *, char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21530 if (__Pyx_ImportFunction_0_29_36(__pyx_t_1,
"sstev", (
void (**)(
void))&__pyx_f_5scipy_6linalg_13cython_lapack_sstev,
"void (char *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *, __pyx_t_5scipy_6linalg_13cython_lapack_s *, int *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21531 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21532 __Pyx_RefNannyFinishContext();
21535 __Pyx_XDECREF(__pyx_t_1);
21536 __Pyx_RefNannyFinishContext();
21541 #ifndef CYTHON_NO_PYINIT_EXPORT
21542 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
21543 #elif PY_MAJOR_VERSION < 3
21545 #define __Pyx_PyMODINIT_FUNC extern "C" void
21547 #define __Pyx_PyMODINIT_FUNC void
21551 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
21553 #define __Pyx_PyMODINIT_FUNC PyObject *
21558 #if PY_MAJOR_VERSION < 3
21562 __Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(
void) CYTHON_SMALL_CODE;
21563 __Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(
void)
21564 #if CYTHON_PEP489_MULTI_PHASE_INIT
21566 return PyModuleDef_Init(&__pyx_moduledef);
21568 static CYTHON_SMALL_CODE
int __Pyx_check_single_interpreter(
void) {
21569 #if PY_VERSION_HEX >= 0x030700A1
21570 static PY_INT64_T main_interpreter_id = -1;
21571 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
21572 if (main_interpreter_id == -1) {
21573 main_interpreter_id = current_id;
21574 return (unlikely(current_id == -1)) ? -1 : 0;
21575 }
else if (unlikely(main_interpreter_id != current_id))
21577 static PyInterpreterState *main_interpreter = NULL;
21578 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
21579 if (!main_interpreter) {
21580 main_interpreter = current_interpreter;
21581 }
else if (unlikely(main_interpreter != current_interpreter))
21586 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
21591 static CYTHON_SMALL_CODE
int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict,
const char* from_name,
const char* to_name,
int allow_none) {
21592 PyObject *value = PyObject_GetAttrString(spec, from_name);
21594 if (likely(value)) {
21595 if (allow_none || value != Py_None) {
21596 result = PyDict_SetItemString(moddict, to_name, value);
21599 }
else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
21606 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
21607 PyObject *module = NULL, *moddict, *modname;
21608 if (__Pyx_check_single_interpreter())
21611 return __Pyx_NewRef(__pyx_m);
21612 modname = PyObject_GetAttrString(spec,
"name");
21613 if (unlikely(!modname))
goto bad;
21614 module = PyModule_NewObject(modname);
21615 Py_DECREF(modname);
21616 if (unlikely(!module))
goto bad;
21617 moddict = PyModule_GetDict(module);
21618 if (unlikely(!moddict))
goto bad;
21619 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"loader",
"__loader__", 1) < 0))
goto bad;
21620 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"origin",
"__file__", 1) < 0))
goto bad;
21621 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"parent",
"__package__", 1) < 0))
goto bad;
21622 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict,
"submodule_search_locations",
"__path__", 0) < 0))
goto bad;
21625 Py_XDECREF(module);
21630 static CYTHON_SMALL_CODE
int __pyx_pymod_exec_py_c_trace_estimator(PyObject *__pyx_pyinit_module)
21634 __Pyx_TraceDeclarations
21635 PyObject *__pyx_t_1 = NULL;
21636 static PyThread_type_lock __pyx_t_2[8];
21637 int __pyx_lineno = 0;
21638 const char *__pyx_filename = NULL;
21639 int __pyx_clineno = 0;
21640 __Pyx_RefNannyDeclarations
21641 #if CYTHON_PEP489_MULTI_PHASE_INIT
21643 if (__pyx_m == __pyx_pyinit_module)
return 0;
21644 PyErr_SetString(PyExc_RuntimeError,
"Module 'py_c_trace_estimator' has already been imported. Re-initialisation is not supported.");
21647 #elif PY_MAJOR_VERSION >= 3
21648 if (__pyx_m)
return __Pyx_NewRef(__pyx_m);
21650 #if CYTHON_REFNANNY
21651 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"refnanny");
21652 if (!__Pyx_RefNanny) {
21654 __Pyx_RefNanny = __Pyx_RefNannyImportAPI(
"Cython.Runtime.refnanny");
21655 if (!__Pyx_RefNanny)
21656 Py_FatalError(
"failed to import 'refnanny' module");
21659 __Pyx_RefNannySetupContext(
"__Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(void)", 0);
21660 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21661 #ifdef __Pxy_PyFrame_Initialize_Offsets
21662 __Pxy_PyFrame_Initialize_Offsets();
21664 __pyx_empty_tuple = PyTuple_New(0);
if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
21665 __pyx_empty_bytes = PyBytes_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
21666 __pyx_empty_unicode = PyUnicode_FromStringAndSize(
"", 0);
if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
21667 #ifdef __Pyx_CyFunction_USED
21668 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21670 #ifdef __Pyx_FusedFunction_USED
21671 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21673 #ifdef __Pyx_Coroutine_USED
21674 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21676 #ifdef __Pyx_Generator_USED
21677 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21679 #ifdef __Pyx_AsyncGen_USED
21680 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21682 #ifdef __Pyx_StopAsyncIteration_USED
21683 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21687 #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
21688 PyEval_InitThreads();
21691 #if CYTHON_PEP489_MULTI_PHASE_INIT
21692 __pyx_m = __pyx_pyinit_module;
21693 Py_INCREF(__pyx_m);
21695 #if PY_MAJOR_VERSION < 3
21696 __pyx_m = Py_InitModule4(
"py_c_trace_estimator", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
21698 __pyx_m = PyModule_Create(&__pyx_moduledef);
21700 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
21702 __pyx_d = PyModule_GetDict(__pyx_m);
if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
21703 Py_INCREF(__pyx_d);
21704 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME);
if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
21705 Py_INCREF(__pyx_b);
21706 __pyx_cython_runtime = PyImport_AddModule((
char *)
"cython_runtime");
if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
21707 Py_INCREF(__pyx_cython_runtime);
21708 if (PyObject_SetAttrString(__pyx_m,
"__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21710 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21711 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
21712 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21714 if (__pyx_module_is_main_imate___c_trace_estimator__py_c_trace_estimator) {
21715 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21717 #if PY_MAJOR_VERSION >= 3
21719 PyObject *modules = PyImport_GetModuleDict();
if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
21720 if (!PyDict_GetItemString(modules,
"imate._c_trace_estimator.py_c_trace_estimator")) {
21721 if (unlikely(PyDict_SetItemString(modules,
"imate._c_trace_estimator.py_c_trace_estimator", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21726 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21728 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21730 (void)__Pyx_modinit_global_init_code();
21731 (void)__Pyx_modinit_variable_export_code();
21732 if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21733 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21734 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21735 (void)__Pyx_modinit_variable_import_code();
21736 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
21738 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
21739 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21741 __Pyx_TraceCall(
"__Pyx_PyMODINIT_FUNC PyInit_py_c_trace_estimator(void)", __pyx_f[0], 1, 0, __PYX_ERR(0, 1, __pyx_L1_error));
21750 __Pyx_TraceLine(15,0,__PYX_ERR(0, 15, __pyx_L1_error))
21751 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, 0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error)
21752 __Pyx_GOTREF(__pyx_t_1);
21753 if (PyDict_SetItem(__pyx_d, __pyx_n_s_numpy, __pyx_t_1) < 0) __PYX_ERR(0, 15, __pyx_L1_error)
21754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21763 __Pyx_TraceLine(21,0,__PYX_ERR(1, 21, __pyx_L1_error))
21773 __Pyx_TraceLine(41,0,__PYX_ERR(1, 41, __pyx_L1_error))
21783 __Pyx_TraceLine(62,0,__PYX_ERR(1, 62, __pyx_L1_error))
21793 __Pyx_TraceLine(84,0,__PYX_ERR(1, 84, __pyx_L1_error))
21803 __Pyx_TraceLine(38,0,__PYX_ERR(0, 38, __pyx_L1_error))
21805 __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_5imate_18_c_trace_estimator_20py_c_trace_estimator_1pyc_trace_estimator, 0, __pyx_n_s_pyc_trace_estimator, NULL, __pyx_n_s_imate__c_trace_estimator_py_c_tr_2, __pyx_d, ((PyObject *)__pyx_codeobj_));
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error)
21806 __Pyx_GOTREF(__pyx_t_1);
21807 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyc_trace_estimator, __pyx_t_1) < 0) __PYX_ERR(0, 38, __pyx_L1_error)
21808 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21817 __Pyx_TraceLine(168,0,__PYX_ERR(0, 168, __pyx_L1_error))
21827 __Pyx_TraceLine(283,0,__PYX_ERR(0, 283, __pyx_L1_error))
21837 __Pyx_TraceLine(398,0,__PYX_ERR(0, 398, __pyx_L1_error))
21845 __Pyx_TraceLine(1,0,__PYX_ERR(0, 1, __pyx_L1_error))
21846 __pyx_t_1 = __Pyx_PyDict_NewPresized(0);
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
21847 __Pyx_GOTREF(__pyx_t_1);
21848 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
21849 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21858 __Pyx_TraceLine(210,0,__PYX_ERR(2, 210, __pyx_L1_error))
21859 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_array_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 210, __pyx_L1_error)
21860 __Pyx_GOTREF(__pyx_t_1);
21861 if (PyDict_SetItem((PyObject *)__pyx_array_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 210, __pyx_L1_error)
21862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
21863 PyType_Modified(__pyx_array_type);
21872 __Pyx_TraceLine(227,0,__PYX_ERR(2, 227, __pyx_L1_error))
21882 __Pyx_TraceLine(245,0,__PYX_ERR(2, 245, __pyx_L1_error))
21892 __Pyx_TraceLine(287,0,__PYX_ERR(2, 287, __pyx_L1_error))
21893 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__24, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 287, __pyx_L1_error)
21894 __Pyx_GOTREF(__pyx_t_1);
21895 __Pyx_XGOTREF(
generic);
21896 __Pyx_DECREF_SET(
generic, __pyx_t_1);
21897 __Pyx_GIVEREF(__pyx_t_1);
21907 __Pyx_TraceLine(288,0,__PYX_ERR(2, 288, __pyx_L1_error))
21908 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__25, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 288, __pyx_L1_error)
21909 __Pyx_GOTREF(__pyx_t_1);
21910 __Pyx_XGOTREF(strided);
21911 __Pyx_DECREF_SET(strided, __pyx_t_1);
21912 __Pyx_GIVEREF(__pyx_t_1);
21922 __Pyx_TraceLine(289,0,__PYX_ERR(2, 289, __pyx_L1_error))
21923 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__26, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 289, __pyx_L1_error)
21924 __Pyx_GOTREF(__pyx_t_1);
21925 __Pyx_XGOTREF(indirect);
21926 __Pyx_DECREF_SET(indirect, __pyx_t_1);
21927 __Pyx_GIVEREF(__pyx_t_1);
21937 __Pyx_TraceLine(292,0,__PYX_ERR(2, 292, __pyx_L1_error))
21938 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__27, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 292, __pyx_L1_error)
21939 __Pyx_GOTREF(__pyx_t_1);
21940 __Pyx_XGOTREF(contiguous);
21941 __Pyx_DECREF_SET(contiguous, __pyx_t_1);
21942 __Pyx_GIVEREF(__pyx_t_1);
21952 __Pyx_TraceLine(293,0,__PYX_ERR(2, 293, __pyx_L1_error))
21953 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_MemviewEnum_type), __pyx_tuple__28, NULL);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 293, __pyx_L1_error)
21954 __Pyx_GOTREF(__pyx_t_1);
21955 __Pyx_XGOTREF(indirect_contiguous);
21956 __Pyx_DECREF_SET(indirect_contiguous, __pyx_t_1);
21957 __Pyx_GIVEREF(__pyx_t_1);
21967 __Pyx_TraceLine(299,0,__PYX_ERR(2, 299, __pyx_L1_error))
21977 __Pyx_TraceLine(317,0,__PYX_ERR(2, 317, __pyx_L1_error))
21978 __pyx_memoryview_thread_locks_used = 0;
21987 __Pyx_TraceLine(318,0,__PYX_ERR(2, 318, __pyx_L1_error))
21988 __pyx_t_2[0] = PyThread_allocate_lock();
21989 __pyx_t_2[1] = PyThread_allocate_lock();
21990 __pyx_t_2[2] = PyThread_allocate_lock();
21991 __pyx_t_2[3] = PyThread_allocate_lock();
21992 __pyx_t_2[4] = PyThread_allocate_lock();
21993 __pyx_t_2[5] = PyThread_allocate_lock();
21994 __pyx_t_2[6] = PyThread_allocate_lock();
21995 __pyx_t_2[7] = PyThread_allocate_lock();
21996 memcpy(&(__pyx_memoryview_thread_locks[0]), __pyx_t_2,
sizeof(__pyx_memoryview_thread_locks[0]) * (8));
22005 __Pyx_TraceLine(395,0,__PYX_ERR(2, 395, __pyx_L1_error))
22015 __Pyx_TraceLine(433,0,__PYX_ERR(2, 433, __pyx_L1_error))
22025 __Pyx_TraceLine(443,0,__PYX_ERR(2, 443, __pyx_L1_error))
22035 __Pyx_TraceLine(451,0,__PYX_ERR(2, 451, __pyx_L1_error))
22045 __Pyx_TraceLine(483,0,__PYX_ERR(2, 483, __pyx_L1_error))
22055 __Pyx_TraceLine(487,0,__PYX_ERR(2, 487, __pyx_L1_error))
22065 __Pyx_TraceLine(503,0,__PYX_ERR(2, 503, __pyx_L1_error))
22075 __Pyx_TraceLine(551,0,__PYX_ERR(2, 551, __pyx_L1_error))
22076 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 551, __pyx_L1_error)
22077 __Pyx_GOTREF(__pyx_t_1);
22078 if (PyDict_SetItem((PyObject *)__pyx_memoryview_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 551, __pyx_L1_error)
22079 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22080 PyType_Modified(__pyx_memoryview_type);
22089 __Pyx_TraceLine(659,0,__PYX_ERR(2, 659, __pyx_L1_error))
22099 __Pyx_TraceLine(665,0,__PYX_ERR(2, 665, __pyx_L1_error))
22109 __Pyx_TraceLine(668,0,__PYX_ERR(2, 668, __pyx_L1_error))
22119 __Pyx_TraceLine(702,0,__PYX_ERR(2, 702, __pyx_L1_error))
22129 __Pyx_TraceLine(712,0,__PYX_ERR(2, 712, __pyx_L1_error))
22139 __Pyx_TraceLine(809,0,__PYX_ERR(2, 809, __pyx_L1_error))
22149 __Pyx_TraceLine(912,0,__PYX_ERR(2, 912, __pyx_L1_error))
22159 __Pyx_TraceLine(945,0,__PYX_ERR(2, 945, __pyx_L1_error))
22169 __Pyx_TraceLine(981,0,__PYX_ERR(2, 981, __pyx_L1_error))
22179 __Pyx_TraceLine(987,0,__PYX_ERR(2, 987, __pyx_L1_error))
22189 __Pyx_TraceLine(997,0,__PYX_ERR(2, 997, __pyx_L1_error))
22190 __pyx_t_1 = __pyx_capsule_create(((
void *)(&__pyx_memoryview_getbuffer)), ((
char *)
"getbuffer(obj, view, flags)"));
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 997, __pyx_L1_error)
22191 __Pyx_GOTREF(__pyx_t_1);
22192 if (PyDict_SetItem((PyObject *)__pyx_memoryviewslice_type->tp_dict, __pyx_n_s_pyx_getbuffer, __pyx_t_1) < 0) __PYX_ERR(2, 997, __pyx_L1_error)
22193 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22194 PyType_Modified(__pyx_memoryviewslice_type);
22203 __Pyx_TraceLine(1001,0,__PYX_ERR(2, 1001, __pyx_L1_error))
22213 __Pyx_TraceLine(1054,0,__PYX_ERR(2, 1054, __pyx_L1_error))
22223 __Pyx_TraceLine(1065,0,__PYX_ERR(2, 1065, __pyx_L1_error))
22233 __Pyx_TraceLine(1082,0,__PYX_ERR(2, 1082, __pyx_L1_error))
22243 __Pyx_TraceLine(1089,0,__PYX_ERR(2, 1089, __pyx_L1_error))
22253 __Pyx_TraceLine(1111,0,__PYX_ERR(2, 1111, __pyx_L1_error))
22263 __Pyx_TraceLine(1118,0,__PYX_ERR(2, 1118, __pyx_L1_error))
22273 __Pyx_TraceLine(1172,0,__PYX_ERR(2, 1172, __pyx_L1_error))
22283 __Pyx_TraceLine(1179,0,__PYX_ERR(2, 1179, __pyx_L1_error))
22293 __Pyx_TraceLine(1189,0,__PYX_ERR(2, 1189, __pyx_L1_error))
22303 __Pyx_TraceLine(1210,0,__PYX_ERR(2, 1210, __pyx_L1_error))
22313 __Pyx_TraceLine(1253,0,__PYX_ERR(2, 1253, __pyx_L1_error))
22323 __Pyx_TraceLine(1259,0,__PYX_ERR(2, 1259, __pyx_L1_error))
22333 __Pyx_TraceLine(1263,0,__PYX_ERR(2, 1263, __pyx_L1_error))
22343 __Pyx_TraceLine(1270,0,__PYX_ERR(2, 1270, __pyx_L1_error))
22353 __Pyx_TraceLine(1342,0,__PYX_ERR(2, 1342, __pyx_L1_error))
22363 __Pyx_TraceLine(1364,0,__PYX_ERR(2, 1364, __pyx_L1_error))
22373 __Pyx_TraceLine(1373,0,__PYX_ERR(2, 1373, __pyx_L1_error))
22383 __Pyx_TraceLine(1379,0,__PYX_ERR(2, 1379, __pyx_L1_error))
22393 __Pyx_TraceLine(1399,0,__PYX_ERR(2, 1399, __pyx_L1_error))
22403 __Pyx_TraceLine(1409,0,__PYX_ERR(2, 1409, __pyx_L1_error))
22411 __Pyx_TraceLine(1,0,__PYX_ERR(2, 1, __pyx_L1_error))
22412 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_15View_dot_MemoryView_1__pyx_unpickle_Enum, NULL, __pyx_n_s_View_MemoryView);
if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 1, __pyx_L1_error)
22413 __Pyx_GOTREF(__pyx_t_1);
22414 if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle_Enum, __pyx_t_1) < 0) __PYX_ERR(2, 1, __pyx_L1_error)
22415 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
22424 __Pyx_TraceLine(11,0,__PYX_ERR(2, 11, __pyx_L1_error))
22426 __Pyx_TraceReturn(Py_None, 0);
22432 __Pyx_XDECREF(__pyx_t_1);
22435 __Pyx_AddTraceback(
"init imate._c_trace_estimator.py_c_trace_estimator", __pyx_clineno, __pyx_lineno, __pyx_filename);
22438 }
else if (!PyErr_Occurred()) {
22439 PyErr_SetString(PyExc_ImportError,
"init imate._c_trace_estimator.py_c_trace_estimator");
22442 __Pyx_RefNannyFinishContext();
22443 #if CYTHON_PEP489_MULTI_PHASE_INIT
22444 return (__pyx_m != NULL) ? 0 : -1;
22445 #elif PY_MAJOR_VERSION >= 3
22454 #if CYTHON_REFNANNY
22455 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(
const char *modname) {
22456 PyObject *m = NULL, *p = NULL;
22458 m = PyImport_ImportModule(modname);
22460 p = PyObject_GetAttrString(m,
"RefNannyAPI");
22462 r = PyLong_AsVoidPtr(p);
22466 return (__Pyx_RefNannyAPIStruct *)r;
22471 #if CYTHON_USE_TYPE_SLOTS
22472 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
22473 PyTypeObject* tp = Py_TYPE(obj);
22474 if (likely(tp->tp_getattro))
22475 return tp->tp_getattro(obj, attr_name);
22476 #if PY_MAJOR_VERSION < 3
22477 if (likely(tp->tp_getattr))
22478 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
22480 return PyObject_GetAttr(obj, attr_name);
22485 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
22486 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
22487 if (unlikely(!result)) {
22488 PyErr_Format(PyExc_NameError,
22489 #
if PY_MAJOR_VERSION >= 3
22490 "name '%U' is not defined", name);
22492 "name '%.200s' is not defined", PyString_AS_STRING(name));
22499 #if CYTHON_FAST_THREAD_STATE
22500 static CYTHON_INLINE
void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
22501 PyObject *tmp_type, *tmp_value, *tmp_tb;
22502 tmp_type = tstate->curexc_type;
22503 tmp_value = tstate->curexc_value;
22504 tmp_tb = tstate->curexc_traceback;
22505 tstate->curexc_type = type;
22506 tstate->curexc_value = value;
22507 tstate->curexc_traceback = tb;
22508 Py_XDECREF(tmp_type);
22509 Py_XDECREF(tmp_value);
22510 Py_XDECREF(tmp_tb);
22512 static CYTHON_INLINE
void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
22513 *type = tstate->curexc_type;
22514 *value = tstate->curexc_value;
22515 *tb = tstate->curexc_traceback;
22516 tstate->curexc_type = 0;
22517 tstate->curexc_value = 0;
22518 tstate->curexc_traceback = 0;
22524 static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
22525 PyFrameObject** frame,
22526 PyThreadState* tstate,
22527 const char *funcname,
22528 const char *srcfile,
22530 PyObject *type, *value, *traceback;
22532 if (*frame == NULL || !CYTHON_PROFILE_REUSE_FRAME) {
22533 if (*code == NULL) {
22534 *code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
22535 if (*code == NULL)
return 0;
22537 *frame = PyFrame_New(
22543 if (*frame == NULL)
return 0;
22544 if (CYTHON_TRACE && (*frame)->f_trace == NULL) {
22545 Py_INCREF(Py_None);
22546 (*frame)->f_trace = Py_None;
22548 #if PY_VERSION_HEX < 0x030400B1
22550 (*frame)->f_tstate = tstate;
22553 __Pyx_PyFrame_SetLineNumber(*frame, firstlineno);
22555 __Pyx_EnterTracing(tstate);
22556 __Pyx_ErrFetchInState(tstate, &type, &value, &traceback);
22558 if (tstate->c_tracefunc)
22559 retval = tstate->c_tracefunc(tstate->c_traceobj, *frame, PyTrace_CALL, NULL) == 0;
22560 if (retval && tstate->c_profilefunc)
22562 retval = tstate->c_profilefunc(tstate->c_profileobj, *frame, PyTrace_CALL, NULL) == 0;
22563 __Pyx_LeaveTracing(tstate);
22565 __Pyx_ErrRestoreInState(tstate, type, value, traceback);
22566 return __Pyx_IsTracing(tstate, 0, 0) && retval;
22570 Py_XDECREF(traceback);
22574 static PyCodeObject *__Pyx_createFrameCodeObject(
const char *funcname,
const char *srcfile,
int firstlineno) {
22575 PyCodeObject *py_code = 0;
22576 #if PY_MAJOR_VERSION >= 3
22577 py_code = PyCode_NewEmpty(srcfile, funcname, firstlineno);
22578 if (likely(py_code)) {
22579 py_code->co_flags |= CO_OPTIMIZED | CO_NEWLOCALS;
22582 PyObject *py_srcfile = 0;
22583 PyObject *py_funcname = 0;
22584 py_funcname = PyString_FromString(funcname);
22585 if (unlikely(!py_funcname))
goto bad;
22586 py_srcfile = PyString_FromString(srcfile);
22587 if (unlikely(!py_srcfile))
goto bad;
22588 py_code = PyCode_New(
22592 CO_OPTIMIZED | CO_NEWLOCALS,
22605 Py_XDECREF(py_srcfile);
22606 Py_XDECREF(py_funcname);
22613 static void __Pyx_WriteUnraisable(
const char *name, CYTHON_UNUSED
int clineno,
22614 CYTHON_UNUSED
int lineno, CYTHON_UNUSED
const char *filename,
22615 int full_traceback, CYTHON_UNUSED
int nogil) {
22616 PyObject *old_exc, *old_val, *old_tb;
22618 __Pyx_PyThreadState_declare
22620 PyGILState_STATE state;
22622 state = PyGILState_Ensure();
22623 else state = (PyGILState_STATE)0;
22625 __Pyx_PyThreadState_assign
22626 __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
22627 if (full_traceback) {
22628 Py_XINCREF(old_exc);
22629 Py_XINCREF(old_val);
22630 Py_XINCREF(old_tb);
22631 __Pyx_ErrRestore(old_exc, old_val, old_tb);
22634 #if PY_MAJOR_VERSION < 3
22635 ctx = PyString_FromString(name);
22637 ctx = PyUnicode_FromString(name);
22639 __Pyx_ErrRestore(old_exc, old_val, old_tb);
22641 PyErr_WriteUnraisable(Py_None);
22643 PyErr_WriteUnraisable(ctx);
22648 PyGILState_Release(state);
22653 static CYTHON_INLINE
int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2,
int equals) {
22654 #if CYTHON_COMPILING_IN_PYPY
22655 return PyObject_RichCompareBool(s1, s2, equals);
22658 return (equals == Py_EQ);
22659 }
else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
22660 const char *ps1, *ps2;
22661 Py_ssize_t length = PyBytes_GET_SIZE(s1);
22662 if (length != PyBytes_GET_SIZE(s2))
22663 return (equals == Py_NE);
22664 ps1 = PyBytes_AS_STRING(s1);
22665 ps2 = PyBytes_AS_STRING(s2);
22666 if (ps1[0] != ps2[0]) {
22667 return (equals == Py_NE);
22668 }
else if (length == 1) {
22669 return (equals == Py_EQ);
22672 #if CYTHON_USE_UNICODE_INTERNALS && (PY_VERSION_HEX < 0x030B0000)
22673 Py_hash_t hash1, hash2;
22674 hash1 = ((PyBytesObject*)s1)->ob_shash;
22675 hash2 = ((PyBytesObject*)s2)->ob_shash;
22676 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
22677 return (equals == Py_NE);
22680 result = memcmp(ps1, ps2, (
size_t)length);
22681 return (equals == Py_EQ) ? (result == 0) : (result != 0);
22683 }
else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
22684 return (equals == Py_NE);
22685 }
else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
22686 return (equals == Py_NE);
22689 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
22692 result = __Pyx_PyObject_IsTrue(py_result);
22693 Py_DECREF(py_result);
22701 __Pyx_init_memviewslice(
struct __pyx_memoryview_obj *memview,
22703 __Pyx_memviewslice *memviewslice,
22704 int memview_is_new_reference)
22706 __Pyx_RefNannyDeclarations
22708 Py_buffer *buf = &memview->view;
22709 __Pyx_RefNannySetupContext(
"init_memviewslice", 0);
22710 if (unlikely(memviewslice->memview || memviewslice->data)) {
22711 PyErr_SetString(PyExc_ValueError,
22712 "memviewslice is already initialized!");
22715 if (buf->strides) {
22716 for (i = 0; i < ndim; i++) {
22717 memviewslice->strides[i] = buf->strides[i];
22720 Py_ssize_t stride = buf->itemsize;
22721 for (i = ndim - 1; i >= 0; i--) {
22722 memviewslice->strides[i] = stride;
22723 stride *= buf->shape[i];
22726 for (i = 0; i < ndim; i++) {
22727 memviewslice->shape[i] = buf->shape[i];
22728 if (buf->suboffsets) {
22729 memviewslice->suboffsets[i] = buf->suboffsets[i];
22731 memviewslice->suboffsets[i] = -1;
22734 memviewslice->memview = memview;
22735 memviewslice->data = (
char *)buf->buf;
22736 if (__pyx_add_acquisition_count(memview) == 0 && !memview_is_new_reference) {
22737 Py_INCREF(memview);
22742 memviewslice->memview = 0;
22743 memviewslice->data = 0;
22746 __Pyx_RefNannyFinishContext();
22749 #ifndef Py_NO_RETURN
22750 #define Py_NO_RETURN
22752 static void __pyx_fatalerror(
const char *fmt, ...) Py_NO_RETURN {
22755 #if PY_VERSION_HEX >= 0x030A0000 || defined(HAVE_STDARG_PROTOTYPES)
22756 va_start(vargs, fmt);
22760 vsnprintf(msg, 200, fmt, vargs);
22762 Py_FatalError(msg);
22764 static CYTHON_INLINE
int
22765 __pyx_add_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22766 PyThread_type_lock lock)
22769 PyThread_acquire_lock(lock, 1);
22770 result = (*acquisition_count)++;
22771 PyThread_release_lock(lock);
22774 static CYTHON_INLINE
int
22775 __pyx_sub_acquisition_count_locked(__pyx_atomic_int *acquisition_count,
22776 PyThread_type_lock lock)
22779 PyThread_acquire_lock(lock, 1);
22780 result = (*acquisition_count)--;
22781 PyThread_release_lock(lock);
22784 static CYTHON_INLINE
void
22785 __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice,
int have_gil,
int lineno)
22788 struct __pyx_memoryview_obj *memview = memslice->memview;
22789 if (unlikely(!memview || (PyObject *) memview == Py_None))
22791 if (unlikely(__pyx_get_slice_count(memview) < 0))
22792 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22793 __pyx_get_slice_count(memview), lineno);
22794 first_time = __pyx_add_acquisition_count(memview) == 0;
22795 if (unlikely(first_time)) {
22797 Py_INCREF((PyObject *) memview);
22799 PyGILState_STATE _gilstate = PyGILState_Ensure();
22800 Py_INCREF((PyObject *) memview);
22801 PyGILState_Release(_gilstate);
22805 static CYTHON_INLINE
void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice,
22806 int have_gil,
int lineno) {
22808 struct __pyx_memoryview_obj *memview = memslice->memview;
22809 if (unlikely(!memview || (PyObject *) memview == Py_None)) {
22810 memslice->memview = NULL;
22813 if (unlikely(__pyx_get_slice_count(memview) <= 0))
22814 __pyx_fatalerror(
"Acquisition count is %d (line %d)",
22815 __pyx_get_slice_count(memview), lineno);
22816 last_time = __pyx_sub_acquisition_count(memview) == 1;
22817 memslice->data = NULL;
22818 if (unlikely(last_time)) {
22820 Py_CLEAR(memslice->memview);
22822 PyGILState_STATE _gilstate = PyGILState_Ensure();
22823 Py_CLEAR(memslice->memview);
22824 PyGILState_Release(_gilstate);
22827 memslice->memview = NULL;
22832 #if CYTHON_COMPILING_IN_CPYTHON
22833 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
22835 ternaryfunc call = Py_TYPE(func)->tp_call;
22836 if (unlikely(!call))
22837 return PyObject_Call(func, arg, kw);
22838 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
22840 result = (*call)(func, arg, kw);
22841 Py_LeaveRecursiveCall();
22842 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
22845 "NULL result without error in PyObject_Call");
22852 #if PY_MAJOR_VERSION < 3
22853 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
22854 CYTHON_UNUSED PyObject *cause) {
22855 __Pyx_PyThreadState_declare
22857 if (!value || value == Py_None)
22861 if (!tb || tb == Py_None)
22865 if (!PyTraceBack_Check(tb)) {
22866 PyErr_SetString(PyExc_TypeError,
22867 "raise: arg 3 must be a traceback or None");
22871 if (PyType_Check(type)) {
22872 #if CYTHON_COMPILING_IN_PYPY
22874 Py_INCREF(Py_None);
22878 PyErr_NormalizeException(&type, &value, &tb);
22881 PyErr_SetString(PyExc_TypeError,
22882 "instance exception may not have a separate value");
22886 type = (PyObject*) Py_TYPE(type);
22888 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
22889 PyErr_SetString(PyExc_TypeError,
22890 "raise: exception class must be a subclass of BaseException");
22894 __Pyx_PyThreadState_assign
22895 __Pyx_ErrRestore(type, value, tb);
22904 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
22905 PyObject* owned_instance = NULL;
22906 if (tb == Py_None) {
22908 }
else if (tb && !PyTraceBack_Check(tb)) {
22909 PyErr_SetString(PyExc_TypeError,
22910 "raise: arg 3 must be a traceback or None");
22913 if (value == Py_None)
22915 if (PyExceptionInstance_Check(type)) {
22917 PyErr_SetString(PyExc_TypeError,
22918 "instance exception may not have a separate value");
22922 type = (PyObject*) Py_TYPE(value);
22923 }
else if (PyExceptionClass_Check(type)) {
22924 PyObject *instance_class = NULL;
22925 if (value && PyExceptionInstance_Check(value)) {
22926 instance_class = (PyObject*) Py_TYPE(value);
22927 if (instance_class != type) {
22928 int is_subclass = PyObject_IsSubclass(instance_class, type);
22929 if (!is_subclass) {
22930 instance_class = NULL;
22931 }
else if (unlikely(is_subclass == -1)) {
22934 type = instance_class;
22938 if (!instance_class) {
22941 args = PyTuple_New(0);
22942 else if (PyTuple_Check(value)) {
22946 args = PyTuple_Pack(1, value);
22949 owned_instance = PyObject_Call(type, args, NULL);
22951 if (!owned_instance)
22953 value = owned_instance;
22954 if (!PyExceptionInstance_Check(value)) {
22955 PyErr_Format(PyExc_TypeError,
22956 "calling %R should have returned an instance of "
22957 "BaseException, not %R",
22958 type, Py_TYPE(value));
22963 PyErr_SetString(PyExc_TypeError,
22964 "raise: exception class must be a subclass of BaseException");
22968 PyObject *fixed_cause;
22969 if (cause == Py_None) {
22970 fixed_cause = NULL;
22971 }
else if (PyExceptionClass_Check(cause)) {
22972 fixed_cause = PyObject_CallObject(cause, NULL);
22973 if (fixed_cause == NULL)
22975 }
else if (PyExceptionInstance_Check(cause)) {
22976 fixed_cause = cause;
22977 Py_INCREF(fixed_cause);
22979 PyErr_SetString(PyExc_TypeError,
22980 "exception causes must derive from "
22984 PyException_SetCause(value, fixed_cause);
22986 PyErr_SetObject(type, value);
22988 #if CYTHON_FAST_THREAD_STATE
22989 PyThreadState *tstate = __Pyx_PyThreadState_Current;
22990 PyObject* tmp_tb = tstate->curexc_traceback;
22991 if (tb != tmp_tb) {
22993 tstate->curexc_traceback = tb;
22994 Py_XDECREF(tmp_tb);
22997 PyObject *tmp_type, *tmp_value, *tmp_tb;
22998 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
23000 PyErr_Restore(tmp_type, tmp_value, tb);
23001 Py_XDECREF(tmp_tb);
23005 Py_XDECREF(owned_instance);
23011 static int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) {
23014 r = PyObject_SetItem(o, j, v);
23018 static CYTHON_INLINE
int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
int is_list,
23019 CYTHON_NCP_UNUSED
int wraparound, CYTHON_NCP_UNUSED
int boundscheck) {
23020 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23021 if (is_list || PyList_CheckExact(o)) {
23022 Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o));
23023 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o)))) {
23024 PyObject* old = PyList_GET_ITEM(o, n);
23026 PyList_SET_ITEM(o, n, v);
23031 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23032 if (likely(m && m->sq_ass_item)) {
23033 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23034 Py_ssize_t l = m->sq_length(o);
23035 if (likely(l >= 0)) {
23038 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23043 return m->sq_ass_item(o, i, v);
23047 #if CYTHON_COMPILING_IN_PYPY
23048 if (is_list || (PySequence_Check(o) && !PyDict_Check(o)))
23050 if (is_list || PySequence_Check(o))
23053 return PySequence_SetItem(o, i, v);
23056 return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v);
23060 static void __Pyx_RaiseArgtupleInvalid(
23061 const char* func_name,
23063 Py_ssize_t num_min,
23064 Py_ssize_t num_max,
23065 Py_ssize_t num_found)
23067 Py_ssize_t num_expected;
23068 const char *more_or_less;
23069 if (num_found < num_min) {
23070 num_expected = num_min;
23071 more_or_less =
"at least";
23073 num_expected = num_max;
23074 more_or_less =
"at most";
23077 more_or_less =
"exactly";
23079 PyErr_Format(PyExc_TypeError,
23080 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T
"d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T
"d given)",
23081 func_name, more_or_less, num_expected,
23082 (num_expected == 1) ?
"" :
"s", num_found);
23086 static void __Pyx_RaiseDoubleKeywordsError(
23087 const char* func_name,
23090 PyErr_Format(PyExc_TypeError,
23091 #
if PY_MAJOR_VERSION >= 3
23092 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
23094 "%s() got multiple values for keyword argument '%s'", func_name,
23095 PyString_AsString(kw_name));
23100 static int __Pyx_ParseOptionalKeywords(
23102 PyObject **argnames[],
23104 PyObject *values[],
23105 Py_ssize_t num_pos_args,
23106 const char* function_name)
23108 PyObject *key = 0, *value = 0;
23109 Py_ssize_t pos = 0;
23111 PyObject*** first_kw_arg = argnames + num_pos_args;
23112 while (PyDict_Next(kwds, &pos, &key, &value)) {
23113 name = first_kw_arg;
23114 while (*name && (**name != key)) name++;
23116 values[name-argnames] = value;
23119 name = first_kw_arg;
23120 #if PY_MAJOR_VERSION < 3
23121 if (likely(PyString_Check(key))) {
23123 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
23124 && _PyString_Eq(**name, key)) {
23125 values[name-argnames] = value;
23130 if (*name)
continue;
23132 PyObject*** argname = argnames;
23133 while (argname != first_kw_arg) {
23134 if ((**argname == key) || (
23135 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
23136 && _PyString_Eq(**argname, key))) {
23137 goto arg_passed_twice;
23144 if (likely(PyUnicode_Check(key))) {
23146 int cmp = (**name == key) ? 0 :
23147 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23148 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23150 PyUnicode_Compare(**name, key);
23151 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23153 values[name-argnames] = value;
23158 if (*name)
continue;
23160 PyObject*** argname = argnames;
23161 while (argname != first_kw_arg) {
23162 int cmp = (**argname == key) ? 0 :
23163 #
if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
23164 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
23166 PyUnicode_Compare(**argname, key);
23167 if (cmp < 0 && unlikely(PyErr_Occurred()))
goto bad;
23168 if (cmp == 0)
goto arg_passed_twice;
23173 goto invalid_keyword_type;
23175 if (unlikely(PyDict_SetItem(kwds2, key, value)))
goto bad;
23177 goto invalid_keyword;
23182 __Pyx_RaiseDoubleKeywordsError(function_name, key);
23184 invalid_keyword_type:
23185 PyErr_Format(PyExc_TypeError,
23186 "%.200s() keywords must be strings", function_name);
23189 PyErr_Format(PyExc_TypeError,
23190 #
if PY_MAJOR_VERSION < 3
23191 "%.200s() got an unexpected keyword argument '%.200s'",
23192 function_name, PyString_AsString(key));
23194 "%s() got an unexpected keyword argument '%U'",
23195 function_name, key);
23202 static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type,
const char *name,
int exact)
23204 if (unlikely(!type)) {
23205 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23209 #if PY_MAJOR_VERSION == 2
23210 if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj)))
return 1;
23214 if (likely(__Pyx_TypeCheck(obj, type)))
return 1;
23216 PyErr_Format(PyExc_TypeError,
23217 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
23218 name, type->tp_name, Py_TYPE(obj)->tp_name);
23223 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
23224 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
23225 PyObject *dict = Py_TYPE(obj)->tp_dict;
23226 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
23228 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
23229 PyObject **dictptr = NULL;
23230 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
23232 #if CYTHON_COMPILING_IN_CPYTHON
23233 dictptr = (likely(offset > 0)) ? (PyObject **) ((
char *)obj + offset) : _PyObject_GetDictPtr(obj);
23235 dictptr = _PyObject_GetDictPtr(obj);
23238 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
23240 static CYTHON_INLINE
int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
23241 PyObject *dict = Py_TYPE(obj)->tp_dict;
23242 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
23244 return obj_dict_version == __Pyx_get_object_dict_version(obj);
23249 #if CYTHON_USE_DICT_VERSIONS
23250 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
23252 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
23256 #if !CYTHON_AVOID_BORROWED_REFS
23257 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
23258 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
23259 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23260 if (likely(result)) {
23261 return __Pyx_NewRef(result);
23262 }
else if (unlikely(PyErr_Occurred())) {
23266 result = PyDict_GetItem(__pyx_d, name);
23267 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23268 if (likely(result)) {
23269 return __Pyx_NewRef(result);
23273 result = PyObject_GetItem(__pyx_d, name);
23274 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
23275 if (likely(result)) {
23276 return __Pyx_NewRef(result);
23280 return __Pyx_GetBuiltinName(name);
23284 #if CYTHON_FAST_PYCCALL
23285 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
23286 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
23287 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
23288 PyObject *
self = PyCFunction_GET_SELF(func);
23289 int flags = PyCFunction_GET_FLAGS(func);
23290 assert(PyCFunction_Check(func));
23291 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
23292 assert(nargs >= 0);
23293 assert(nargs == 0 || args != NULL);
23297 assert(!PyErr_Occurred());
23298 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
23299 return (*((__Pyx_PyCFunctionFastWithKeywords)(
void*)meth)) (
self, args, nargs, NULL);
23301 return (*((__Pyx_PyCFunctionFast)(
void*)meth)) (
self, args, nargs);
23307 #if CYTHON_FAST_PYCALL
23308 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
23309 PyObject *globals) {
23311 PyThreadState *tstate = __Pyx_PyThreadState_Current;
23312 PyObject **fastlocals;
23315 assert(globals != NULL);
23320 assert(tstate != NULL);
23321 f = PyFrame_New(tstate, co, globals, NULL);
23325 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
23326 for (i = 0; i < na; i++) {
23328 fastlocals[i] = *args++;
23330 result = PyEval_EvalFrameEx(f,0);
23331 ++tstate->recursion_depth;
23333 --tstate->recursion_depth;
23336 #if 1 || PY_VERSION_HEX < 0x030600B1
23337 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
23338 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
23339 PyObject *globals = PyFunction_GET_GLOBALS(func);
23340 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
23342 #if PY_MAJOR_VERSION >= 3
23345 PyObject *kwtuple, **k;
23350 assert(kwargs == NULL || PyDict_Check(kwargs));
23351 nk = kwargs ? PyDict_Size(kwargs) : 0;
23352 if (Py_EnterRecursiveCall((
char*)
" while calling a Python object")) {
23356 #
if PY_MAJOR_VERSION >= 3
23357 co->co_kwonlyargcount == 0 &&
23359 likely(kwargs == NULL || nk == 0) &&
23360 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
23361 if (argdefs == NULL && co->co_argcount == nargs) {
23362 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
23365 else if (nargs == 0 && argdefs != NULL
23366 && co->co_argcount == Py_SIZE(argdefs)) {
23369 args = &PyTuple_GET_ITEM(argdefs, 0);
23370 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
23374 if (kwargs != NULL) {
23376 kwtuple = PyTuple_New(2 * nk);
23377 if (kwtuple == NULL) {
23381 k = &PyTuple_GET_ITEM(kwtuple, 0);
23383 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
23394 closure = PyFunction_GET_CLOSURE(func);
23395 #if PY_MAJOR_VERSION >= 3
23396 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
23398 if (argdefs != NULL) {
23399 d = &PyTuple_GET_ITEM(argdefs, 0);
23400 nd = Py_SIZE(argdefs);
23406 #if PY_MAJOR_VERSION >= 3
23407 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
23410 d, (
int)nd, kwdefs, closure);
23412 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
23415 d, (
int)nd, closure);
23417 Py_XDECREF(kwtuple);
23419 Py_LeaveRecursiveCall();
23426 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject*
function, PyObject* arg1, PyObject* arg2) {
23427 PyObject *args, *result = NULL;
23428 #if CYTHON_FAST_PYCALL
23429 if (PyFunction_Check(
function)) {
23430 PyObject *args[2] = {arg1, arg2};
23431 return __Pyx_PyFunction_FastCall(
function, args, 2);
23434 #if CYTHON_FAST_PYCCALL
23435 if (__Pyx_PyFastCFunction_Check(
function)) {
23436 PyObject *args[2] = {arg1, arg2};
23437 return __Pyx_PyCFunction_FastCall(
function, args, 2);
23440 args = PyTuple_New(2);
23441 if (unlikely(!args))
goto done;
23443 PyTuple_SET_ITEM(args, 0, arg1);
23445 PyTuple_SET_ITEM(args, 1, arg2);
23446 Py_INCREF(
function);
23447 result = __Pyx_PyObject_Call(
function, args, NULL);
23449 Py_DECREF(
function);
23455 #if CYTHON_COMPILING_IN_CPYTHON
23456 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
23457 PyObject *
self, *result;
23459 cfunc = PyCFunction_GET_FUNCTION(func);
23460 self = PyCFunction_GET_SELF(func);
23461 if (unlikely(Py_EnterRecursiveCall((
char*)
" while calling a Python object")))
23463 result = cfunc(
self, arg);
23464 Py_LeaveRecursiveCall();
23465 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
23468 "NULL result without error in PyObject_Call");
23475 #if CYTHON_COMPILING_IN_CPYTHON
23476 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23478 PyObject *args = PyTuple_New(1);
23479 if (unlikely(!args))
return NULL;
23481 PyTuple_SET_ITEM(args, 0, arg);
23482 result = __Pyx_PyObject_Call(func, args, NULL);
23486 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23487 #if CYTHON_FAST_PYCALL
23488 if (PyFunction_Check(func)) {
23489 return __Pyx_PyFunction_FastCall(func, &arg, 1);
23492 if (likely(PyCFunction_Check(func))) {
23493 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
23494 return __Pyx_PyObject_CallMethO(func, arg);
23495 #if CYTHON_FAST_PYCCALL
23496 }
else if (__Pyx_PyFastCFunction_Check(func)) {
23497 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
23501 return __Pyx__PyObject_CallOneArg(func, arg);
23504 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
23506 PyObject *args = PyTuple_Pack(1, arg);
23507 if (unlikely(!args))
return NULL;
23508 result = __Pyx_PyObject_Call(func, args, NULL);
23515 static CYTHON_INLINE
int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2,
int equals) {
23516 #if CYTHON_COMPILING_IN_PYPY
23517 return PyObject_RichCompareBool(s1, s2, equals);
23519 #if PY_MAJOR_VERSION < 3
23520 PyObject* owned_ref = NULL;
23522 int s1_is_unicode, s2_is_unicode;
23526 s1_is_unicode = PyUnicode_CheckExact(s1);
23527 s2_is_unicode = PyUnicode_CheckExact(s2);
23528 #if PY_MAJOR_VERSION < 3
23529 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
23530 owned_ref = PyUnicode_FromObject(s2);
23531 if (unlikely(!owned_ref))
23535 }
else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
23536 owned_ref = PyUnicode_FromObject(s1);
23537 if (unlikely(!owned_ref))
23541 }
else if (((!s2_is_unicode) & (!s1_is_unicode))) {
23542 return __Pyx_PyBytes_Equals(s1, s2, equals);
23545 if (s1_is_unicode & s2_is_unicode) {
23548 void *data1, *data2;
23549 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
23551 length = __Pyx_PyUnicode_GET_LENGTH(s1);
23552 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
23555 #if CYTHON_USE_UNICODE_INTERNALS
23557 Py_hash_t hash1, hash2;
23558 #if CYTHON_PEP393_ENABLED
23559 hash1 = ((PyASCIIObject*)s1)->hash;
23560 hash2 = ((PyASCIIObject*)s2)->hash;
23562 hash1 = ((PyUnicodeObject*)s1)->hash;
23563 hash2 = ((PyUnicodeObject*)s2)->hash;
23565 if (hash1 != hash2 && hash1 != -1 && hash2 != -1) {
23570 kind = __Pyx_PyUnicode_KIND(s1);
23571 if (kind != __Pyx_PyUnicode_KIND(s2)) {
23574 data1 = __Pyx_PyUnicode_DATA(s1);
23575 data2 = __Pyx_PyUnicode_DATA(s2);
23576 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
23578 }
else if (length == 1) {
23581 int result = memcmp(data1, data2, (
size_t)(length * kind));
23582 #if PY_MAJOR_VERSION < 3
23583 Py_XDECREF(owned_ref);
23585 return (equals == Py_EQ) ? (result == 0) : (result != 0);
23587 }
else if ((s1 == Py_None) & s2_is_unicode) {
23589 }
else if ((s2 == Py_None) & s1_is_unicode) {
23593 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
23594 #if PY_MAJOR_VERSION < 3
23595 Py_XDECREF(owned_ref);
23599 result = __Pyx_PyObject_IsTrue(py_result);
23600 Py_DECREF(py_result);
23604 #if PY_MAJOR_VERSION < 3
23605 Py_XDECREF(owned_ref);
23607 return (equals == Py_EQ);
23609 #if PY_MAJOR_VERSION < 3
23610 Py_XDECREF(owned_ref);
23612 return (equals == Py_NE);
23617 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
23618 #if CYTHON_USE_TYPE_SLOTS
23619 #if PY_MAJOR_VERSION >= 3
23620 if (likely(PyUnicode_Check(n)))
23622 if (likely(PyString_Check(n)))
23624 return __Pyx_PyObject_GetAttrStr(o, n);
23626 return PyObject_GetAttr(o, n);
23630 static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
23632 if (!j)
return NULL;
23633 r = PyObject_GetItem(o, j);
23637 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
23638 CYTHON_NCP_UNUSED
int wraparound,
23639 CYTHON_NCP_UNUSED
int boundscheck) {
23640 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23641 Py_ssize_t wrapped_i = i;
23642 if (wraparound & unlikely(i < 0)) {
23643 wrapped_i += PyList_GET_SIZE(o);
23645 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyList_GET_SIZE(o)))) {
23646 PyObject *r = PyList_GET_ITEM(o, wrapped_i);
23650 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23652 return PySequence_GetItem(o, i);
23655 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
23656 CYTHON_NCP_UNUSED
int wraparound,
23657 CYTHON_NCP_UNUSED
int boundscheck) {
23658 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
23659 Py_ssize_t wrapped_i = i;
23660 if (wraparound & unlikely(i < 0)) {
23661 wrapped_i += PyTuple_GET_SIZE(o);
23663 if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) {
23664 PyObject *r = PyTuple_GET_ITEM(o, wrapped_i);
23668 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23670 return PySequence_GetItem(o, i);
23673 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
int is_list,
23674 CYTHON_NCP_UNUSED
int wraparound,
23675 CYTHON_NCP_UNUSED
int boundscheck) {
23676 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
23677 if (is_list || PyList_CheckExact(o)) {
23678 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
23679 if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) {
23680 PyObject *r = PyList_GET_ITEM(o, n);
23685 else if (PyTuple_CheckExact(o)) {
23686 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
23687 if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) {
23688 PyObject *r = PyTuple_GET_ITEM(o, n);
23693 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
23694 if (likely(m && m->sq_item)) {
23695 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
23696 Py_ssize_t l = m->sq_length(o);
23697 if (likely(l >= 0)) {
23700 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
23705 return m->sq_item(o, i);
23709 if (is_list || PySequence_Check(o)) {
23710 return PySequence_GetItem(o, i);
23713 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
23717 #if CYTHON_USE_TYPE_SLOTS
23718 static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) {
23719 PyObject *runerr = NULL;
23720 Py_ssize_t key_value;
23721 PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence;
23722 if (unlikely(!(m && m->sq_item))) {
23723 PyErr_Format(PyExc_TypeError,
"'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name);
23726 key_value = __Pyx_PyIndex_AsSsize_t(index);
23727 if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) {
23728 return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1);
23730 if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) {
23732 PyErr_Format(PyExc_IndexError,
"cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name);
23736 static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) {
23737 PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping;
23738 if (likely(m && m->mp_subscript)) {
23739 return m->mp_subscript(obj, key);
23741 return __Pyx_PyObject_GetIndex(obj, key);
23746 static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
23747 const char* cstring, Py_ssize_t start, Py_ssize_t stop,
23748 const char* encoding,
const char* errors,
23749 PyObject* (*decode_func)(
const char *s, Py_ssize_t size,
const char *errors)) {
23751 if (unlikely((start < 0) | (stop < 0))) {
23752 size_t slen = strlen(cstring);
23753 if (unlikely(slen > (
size_t) PY_SSIZE_T_MAX)) {
23754 PyErr_SetString(PyExc_OverflowError,
23755 "c-string too long to convert to Python");
23758 length = (Py_ssize_t) slen;
23767 if (unlikely(stop <= start))
23768 return __Pyx_NewRef(__pyx_empty_unicode);
23769 length = stop - start;
23772 return decode_func(cstring, length, errors);
23774 return PyUnicode_Decode(cstring, length, encoding, errors);
23779 #if CYTHON_FAST_THREAD_STATE
23780 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
23782 n = PyTuple_GET_SIZE(tuple);
23783 #if PY_MAJOR_VERSION >= 3
23784 for (i=0; i<n; i++) {
23785 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
23788 for (i=0; i<n; i++) {
23789 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i)))
return 1;
23793 static CYTHON_INLINE
int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
23794 PyObject *exc_type = tstate->curexc_type;
23795 if (exc_type == err)
return 1;
23796 if (unlikely(!exc_type))
return 0;
23797 if (unlikely(PyTuple_Check(err)))
23798 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
23799 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
23804 static PyObject *__Pyx_GetAttr3Default(PyObject *d) {
23805 __Pyx_PyThreadState_declare
23806 __Pyx_PyThreadState_assign
23807 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
23809 __Pyx_PyErr_Clear();
23813 static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) {
23814 PyObject *r = __Pyx_GetAttr(o, n);
23815 return (likely(r)) ? r : __Pyx_GetAttr3Default(d);
23819 static CYTHON_INLINE
void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
23820 PyErr_Format(PyExc_ValueError,
23821 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T
"d)", expected);
23825 static CYTHON_INLINE
void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
23826 PyErr_Format(PyExc_ValueError,
23827 "need more than %" CYTHON_FORMAT_SSIZE_T
"d value%.1s to unpack",
23828 index, (index == 1) ?
"" :
"s");
23832 static CYTHON_INLINE
void __Pyx_RaiseNoneNotIterableError(
void) {
23833 PyErr_SetString(PyExc_TypeError,
"'NoneType' object is not iterable");
23837 static CYTHON_INLINE
int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
23838 if (unlikely(!type)) {
23839 PyErr_SetString(PyExc_SystemError,
"Missing type object");
23842 if (likely(__Pyx_TypeCheck(obj, type)))
23844 PyErr_Format(PyExc_TypeError,
"Cannot convert %.200s to %.200s",
23845 Py_TYPE(obj)->tp_name, type->tp_name);
23850 #if CYTHON_USE_EXC_INFO_STACK
23851 static _PyErr_StackItem *
23852 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
23854 _PyErr_StackItem *exc_info = tstate->exc_info;
23855 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
23856 exc_info->previous_item != NULL)
23858 exc_info = exc_info->previous_item;
23865 #if CYTHON_FAST_THREAD_STATE
23866 static CYTHON_INLINE
void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23867 #if CYTHON_USE_EXC_INFO_STACK
23868 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
23869 *type = exc_info->exc_type;
23870 *value = exc_info->exc_value;
23871 *tb = exc_info->exc_traceback;
23873 *type = tstate->exc_type;
23874 *value = tstate->exc_value;
23875 *tb = tstate->exc_traceback;
23878 Py_XINCREF(*value);
23881 static CYTHON_INLINE
void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
23882 PyObject *tmp_type, *tmp_value, *tmp_tb;
23883 #if CYTHON_USE_EXC_INFO_STACK
23884 _PyErr_StackItem *exc_info = tstate->exc_info;
23885 tmp_type = exc_info->exc_type;
23886 tmp_value = exc_info->exc_value;
23887 tmp_tb = exc_info->exc_traceback;
23888 exc_info->exc_type = type;
23889 exc_info->exc_value = value;
23890 exc_info->exc_traceback = tb;
23892 tmp_type = tstate->exc_type;
23893 tmp_value = tstate->exc_value;
23894 tmp_tb = tstate->exc_traceback;
23895 tstate->exc_type = type;
23896 tstate->exc_value = value;
23897 tstate->exc_traceback = tb;
23899 Py_XDECREF(tmp_type);
23900 Py_XDECREF(tmp_value);
23901 Py_XDECREF(tmp_tb);
23906 #if CYTHON_FAST_THREAD_STATE
23907 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
23909 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
23912 PyObject *local_type, *local_value, *local_tb;
23913 #if CYTHON_FAST_THREAD_STATE
23914 PyObject *tmp_type, *tmp_value, *tmp_tb;
23915 local_type = tstate->curexc_type;
23916 local_value = tstate->curexc_value;
23917 local_tb = tstate->curexc_traceback;
23918 tstate->curexc_type = 0;
23919 tstate->curexc_value = 0;
23920 tstate->curexc_traceback = 0;
23922 PyErr_Fetch(&local_type, &local_value, &local_tb);
23924 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
23925 #if CYTHON_FAST_THREAD_STATE
23926 if (unlikely(tstate->curexc_type))
23928 if (unlikely(PyErr_Occurred()))
23931 #if PY_MAJOR_VERSION >= 3
23933 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
23937 Py_XINCREF(local_tb);
23938 Py_XINCREF(local_type);
23939 Py_XINCREF(local_value);
23940 *type = local_type;
23941 *value = local_value;
23943 #if CYTHON_FAST_THREAD_STATE
23944 #if CYTHON_USE_EXC_INFO_STACK
23946 _PyErr_StackItem *exc_info = tstate->exc_info;
23947 tmp_type = exc_info->exc_type;
23948 tmp_value = exc_info->exc_value;
23949 tmp_tb = exc_info->exc_traceback;
23950 exc_info->exc_type = local_type;
23951 exc_info->exc_value = local_value;
23952 exc_info->exc_traceback = local_tb;
23955 tmp_type = tstate->exc_type;
23956 tmp_value = tstate->exc_value;
23957 tmp_tb = tstate->exc_traceback;
23958 tstate->exc_type = local_type;
23959 tstate->exc_value = local_value;
23960 tstate->exc_traceback = local_tb;
23962 Py_XDECREF(tmp_type);
23963 Py_XDECREF(tmp_value);
23964 Py_XDECREF(tmp_tb);
23966 PyErr_SetExcInfo(local_type, local_value, local_tb);
23973 Py_XDECREF(local_type);
23974 Py_XDECREF(local_value);
23975 Py_XDECREF(local_tb);
23980 #if CYTHON_FAST_THREAD_STATE
23981 static CYTHON_INLINE
void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
23982 PyObject *tmp_type, *tmp_value, *tmp_tb;
23983 #if CYTHON_USE_EXC_INFO_STACK
23984 _PyErr_StackItem *exc_info = tstate->exc_info;
23985 tmp_type = exc_info->exc_type;
23986 tmp_value = exc_info->exc_value;
23987 tmp_tb = exc_info->exc_traceback;
23988 exc_info->exc_type = *type;
23989 exc_info->exc_value = *value;
23990 exc_info->exc_traceback = *tb;
23992 tmp_type = tstate->exc_type;
23993 tmp_value = tstate->exc_value;
23994 tmp_tb = tstate->exc_traceback;
23995 tstate->exc_type = *type;
23996 tstate->exc_value = *value;
23997 tstate->exc_traceback = *tb;
24000 *value = tmp_value;
24004 static CYTHON_INLINE
void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
24005 PyObject *tmp_type, *tmp_value, *tmp_tb;
24006 PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
24007 PyErr_SetExcInfo(*type, *value, *tb);
24009 *value = tmp_value;
24015 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list,
int level) {
24016 PyObject *empty_list = 0;
24017 PyObject *module = 0;
24018 PyObject *global_dict = 0;
24019 PyObject *empty_dict = 0;
24021 #if PY_MAJOR_VERSION < 3
24022 PyObject *py_import;
24023 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
24030 empty_list = PyList_New(0);
24035 global_dict = PyModule_GetDict(__pyx_m);
24038 empty_dict = PyDict_New();
24042 #if PY_MAJOR_VERSION >= 3
24044 if ((1) && (strchr(__Pyx_MODULE_NAME,
'.'))) {
24045 module = PyImport_ImportModuleLevelObject(
24046 name, global_dict, empty_dict, list, 1);
24048 if (!PyErr_ExceptionMatches(PyExc_ImportError))
24057 #if PY_MAJOR_VERSION < 3
24058 PyObject *py_level = PyInt_FromLong(level);
24061 module = PyObject_CallFunctionObjArgs(py_import,
24062 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
24063 Py_DECREF(py_level);
24065 module = PyImport_ImportModuleLevelObject(
24066 name, global_dict, empty_dict, list, level);
24071 #if PY_MAJOR_VERSION < 3
24072 Py_XDECREF(py_import);
24074 Py_XDECREF(empty_list);
24075 Py_XDECREF(empty_dict);
24080 #if CYTHON_COMPILING_IN_CPYTHON
24081 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
24087 return b == &PyBaseObject_Type;
24089 static CYTHON_INLINE
int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
24091 if (a == b)
return 1;
24095 n = PyTuple_GET_SIZE(mro);
24096 for (i = 0; i < n; i++) {
24097 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
24102 return __Pyx_InBases(a, b);
24104 #if PY_MAJOR_VERSION == 2
24105 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
24106 PyObject *exception, *value, *tb;
24108 __Pyx_PyThreadState_declare
24109 __Pyx_PyThreadState_assign
24110 __Pyx_ErrFetch(&exception, &value, &tb);
24111 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
24112 if (unlikely(res == -1)) {
24113 PyErr_WriteUnraisable(err);
24117 res = PyObject_IsSubclass(err, exc_type2);
24118 if (unlikely(res == -1)) {
24119 PyErr_WriteUnraisable(err);
24123 __Pyx_ErrRestore(exception, value, tb);
24127 static CYTHON_INLINE
int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
24128 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
24130 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
24135 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
24137 assert(PyExceptionClass_Check(exc_type));
24138 n = PyTuple_GET_SIZE(tuple);
24139 #if PY_MAJOR_VERSION >= 3
24140 for (i=0; i<n; i++) {
24141 if (exc_type == PyTuple_GET_ITEM(tuple, i))
return 1;
24144 for (i=0; i<n; i++) {
24145 PyObject *t = PyTuple_GET_ITEM(tuple, i);
24146 #if PY_MAJOR_VERSION < 3
24147 if (likely(exc_type == t))
return 1;
24149 if (likely(PyExceptionClass_Check(t))) {
24150 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t))
return 1;
24156 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
24157 if (likely(err == exc_type))
return 1;
24158 if (likely(PyExceptionClass_Check(err))) {
24159 if (likely(PyExceptionClass_Check(exc_type))) {
24160 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
24161 }
else if (likely(PyTuple_Check(exc_type))) {
24162 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
24166 return PyErr_GivenExceptionMatches(err, exc_type);
24168 static CYTHON_INLINE
int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
24169 assert(PyExceptionClass_Check(exc_type1));
24170 assert(PyExceptionClass_Check(exc_type2));
24171 if (likely(err == exc_type1 || err == exc_type2))
return 1;
24172 if (likely(PyExceptionClass_Check(err))) {
24173 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
24175 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
24180 #if !CYTHON_COMPILING_IN_PYPY
24181 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED
long intval,
int inplace,
int zerodivision_check) {
24183 (void)zerodivision_check;
24184 #if PY_MAJOR_VERSION < 3
24185 if (likely(PyInt_CheckExact(op1))) {
24186 const long b = intval;
24188 long a = PyInt_AS_LONG(op1);
24189 x = (long)((
unsigned long)a + b);
24190 if (likely((x^a) >= 0 || (x^b) >= 0))
24191 return PyInt_FromLong(x);
24192 return PyLong_Type.tp_as_number->nb_add(op1, op2);
24195 #if CYTHON_USE_PYLONG_INTERNALS
24196 if (likely(PyLong_CheckExact(op1))) {
24197 const long b = intval;
24199 #ifdef HAVE_LONG_LONG
24200 const PY_LONG_LONG llb = intval;
24201 PY_LONG_LONG lla, llx;
24203 const digit* digits = ((PyLongObject*)op1)->ob_digit;
24204 const Py_ssize_t size = Py_SIZE(op1);
24205 if (likely(__Pyx_sst_abs(size) <= 1)) {
24206 a = likely(size) ? digits[0] : 0;
24207 if (size == -1) a = -a;
24211 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24212 a = -(long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24214 #ifdef HAVE_LONG_LONG
24215 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24216 lla = -(PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24220 CYTHON_FALLTHROUGH;
24222 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
24223 a = (long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24225 #ifdef HAVE_LONG_LONG
24226 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
24227 lla = (PY_LONG_LONG) (((((
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24231 CYTHON_FALLTHROUGH;
24233 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24234 a = -(long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24236 #ifdef HAVE_LONG_LONG
24237 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24238 lla = -(PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24242 CYTHON_FALLTHROUGH;
24244 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
24245 a = (long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24247 #ifdef HAVE_LONG_LONG
24248 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
24249 lla = (PY_LONG_LONG) (((((((
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24253 CYTHON_FALLTHROUGH;
24255 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24256 a = -(long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24258 #ifdef HAVE_LONG_LONG
24259 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24260 lla = -(PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24264 CYTHON_FALLTHROUGH;
24266 if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
24267 a = (long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0]));
24269 #ifdef HAVE_LONG_LONG
24270 }
else if (8 *
sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
24271 lla = (PY_LONG_LONG) (((((((((
unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (
unsigned PY_LONG_LONG)digits[0]));
24275 CYTHON_FALLTHROUGH;
24276 default:
return PyLong_Type.tp_as_number->nb_add(op1, op2);
24280 return PyLong_FromLong(x);
24281 #ifdef HAVE_LONG_LONG
24284 return PyLong_FromLongLong(llx);
24290 if (PyFloat_CheckExact(op1)) {
24291 const long b = intval;
24292 double a = PyFloat_AS_DOUBLE(op1);
24294 PyFPE_START_PROTECT(
"add",
return NULL)
24295 result = ((double)a) + (double)b;
24296 PyFPE_END_PROTECT(result)
24297 return PyFloat_FromDouble(result);
24299 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
24304 static CYTHON_INLINE
void __Pyx_RaiseUnboundLocalError(
const char *varname) {
24305 PyErr_Format(PyExc_UnboundLocalError,
"local variable '%s' referenced before assignment", varname);
24309 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
24310 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
24311 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
24312 PyErr_Format(PyExc_ImportError,
24313 #
if PY_MAJOR_VERSION < 3
24314 "cannot import name %.230s", PyString_AS_STRING(name));
24316 "cannot import name %S", name);
24323 static CYTHON_INLINE
int __Pyx_HasAttr(PyObject *o, PyObject *n) {
24325 if (unlikely(!__Pyx_PyBaseString_Check(n))) {
24326 PyErr_SetString(PyExc_TypeError,
24327 "hasattr(): attribute name must be string");
24330 r = __Pyx_GetAttr(o, n);
24331 if (unlikely(!r)) {
24341 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24342 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
24343 PyErr_Format(PyExc_AttributeError,
24344 #
if PY_MAJOR_VERSION >= 3
24345 "'%.50s' object has no attribute '%U'",
24346 tp->tp_name, attr_name);
24348 "'%.50s' object has no attribute '%.400s'",
24349 tp->tp_name, PyString_AS_STRING(attr_name));
24353 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
24355 PyTypeObject *tp = Py_TYPE(obj);
24356 if (unlikely(!PyString_Check(attr_name))) {
24357 return PyObject_GenericGetAttr(obj, attr_name);
24359 assert(!tp->tp_dictoffset);
24360 descr = _PyType_Lookup(tp, attr_name);
24361 if (unlikely(!descr)) {
24362 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
24365 #if PY_MAJOR_VERSION < 3
24366 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
24369 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
24371 PyObject *res = f(descr, obj, (PyObject *)tp);
24381 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
24382 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
24383 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
24384 return PyObject_GenericGetAttr(obj, attr_name);
24386 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
24391 static int __Pyx_SetVtable(PyObject *dict,
void *vtable) {
24392 #if PY_VERSION_HEX >= 0x02070000
24393 PyObject *ob = PyCapsule_New(vtable, 0, 0);
24395 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
24399 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
24409 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(
void) {
24410 __Pyx_PyThreadState_declare
24411 __Pyx_PyThreadState_assign
24412 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
24413 __Pyx_PyErr_Clear();
24415 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
24417 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
24418 PyTypeObject* tp = Py_TYPE(obj);
24419 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
24420 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
24423 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
24424 if (unlikely(!result)) {
24425 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
24431 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
24433 PyObject *name_attr;
24434 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
24435 if (likely(name_attr)) {
24436 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
24440 if (unlikely(ret < 0)) {
24444 Py_XDECREF(name_attr);
24447 static int __Pyx_setup_reduce(PyObject* type_obj) {
24449 PyObject *object_reduce = NULL;
24450 PyObject *object_getstate = NULL;
24451 PyObject *object_reduce_ex = NULL;
24452 PyObject *reduce = NULL;
24453 PyObject *reduce_ex = NULL;
24454 PyObject *reduce_cython = NULL;
24455 PyObject *setstate = NULL;
24456 PyObject *setstate_cython = NULL;
24457 PyObject *getstate = NULL;
24458 #if CYTHON_USE_PYTYPE_LOOKUP
24459 getstate = _PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate);
24461 getstate = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_getstate);
24462 if (!getstate && PyErr_Occurred()) {
24467 #if CYTHON_USE_PYTYPE_LOOKUP
24468 object_getstate = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_getstate);
24470 object_getstate = __Pyx_PyObject_GetAttrStrNoError((PyObject*)&PyBaseObject_Type, __pyx_n_s_getstate);
24471 if (!object_getstate && PyErr_Occurred()) {
24475 if (object_getstate != getstate) {
24479 #if CYTHON_USE_PYTYPE_LOOKUP
24480 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24482 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex);
if (!object_reduce_ex)
goto __PYX_BAD;
24484 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex);
if (unlikely(!reduce_ex))
goto __PYX_BAD;
24485 if (reduce_ex == object_reduce_ex) {
24486 #if CYTHON_USE_PYTYPE_LOOKUP
24487 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24489 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce);
if (!object_reduce)
goto __PYX_BAD;
24491 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce);
if (unlikely(!reduce))
goto __PYX_BAD;
24492 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
24493 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
24494 if (likely(reduce_cython)) {
24495 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24496 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24497 }
else if (reduce == object_reduce || PyErr_Occurred()) {
24500 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
24501 if (!setstate) PyErr_Clear();
24502 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
24503 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
24504 if (likely(setstate_cython)) {
24505 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24506 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython);
if (unlikely(ret < 0))
goto __PYX_BAD;
24507 }
else if (!setstate || PyErr_Occurred()) {
24511 PyType_Modified((PyTypeObject*)type_obj);
24516 if (!PyErr_Occurred())
24517 PyErr_Format(PyExc_RuntimeError,
"Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
24520 #if !CYTHON_USE_PYTYPE_LOOKUP
24521 Py_XDECREF(object_reduce);
24522 Py_XDECREF(object_reduce_ex);
24523 Py_XDECREF(object_getstate);
24524 Py_XDECREF(getstate);
24526 Py_XDECREF(reduce);
24527 Py_XDECREF(reduce_ex);
24528 Py_XDECREF(reduce_cython);
24529 Py_XDECREF(setstate);
24530 Py_XDECREF(setstate_cython);
24535 #ifndef __PYX_HAVE_RT_ImportType_0_29_36
24536 #define __PYX_HAVE_RT_ImportType_0_29_36
24537 static PyTypeObject *__Pyx_ImportType_0_29_36(PyObject *module,
const char *module_name,
const char *class_name,
24538 size_t size,
size_t alignment,
enum __Pyx_ImportType_CheckSize_0_29_36 check_size)
24540 PyObject *result = 0;
24542 Py_ssize_t basicsize;
24543 Py_ssize_t itemsize;
24544 #ifdef Py_LIMITED_API
24545 PyObject *py_basicsize;
24546 PyObject *py_itemsize;
24548 result = PyObject_GetAttrString(module, class_name);
24551 if (!PyType_Check(result)) {
24552 PyErr_Format(PyExc_TypeError,
24553 "%.200s.%.200s is not a type object",
24554 module_name, class_name);
24557 #ifndef Py_LIMITED_API
24558 basicsize = ((PyTypeObject *)result)->tp_basicsize;
24559 itemsize = ((PyTypeObject *)result)->tp_itemsize;
24561 py_basicsize = PyObject_GetAttrString(result,
"__basicsize__");
24564 basicsize = PyLong_AsSsize_t(py_basicsize);
24565 Py_DECREF(py_basicsize);
24567 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
24569 py_itemsize = PyObject_GetAttrString(result,
"__itemsize__");
24572 itemsize = PyLong_AsSsize_t(py_itemsize);
24573 Py_DECREF(py_itemsize);
24575 if (itemsize == (Py_ssize_t)-1 && PyErr_Occurred())
24579 if (size % alignment) {
24580 alignment = size % alignment;
24582 if (itemsize < (Py_ssize_t)alignment)
24583 itemsize = (Py_ssize_t)alignment;
24585 if ((
size_t)(basicsize + itemsize) < size) {
24586 PyErr_Format(PyExc_ValueError,
24587 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24588 "Expected %zd from C header, got %zd from PyObject",
24589 module_name, class_name, size, basicsize);
24592 if (check_size == __Pyx_ImportType_CheckSize_Error_0_29_36 && (
size_t)basicsize != size) {
24593 PyErr_Format(PyExc_ValueError,
24594 "%.200s.%.200s size changed, may indicate binary incompatibility. "
24595 "Expected %zd from C header, got %zd from PyObject",
24596 module_name, class_name, size, basicsize);
24599 else if (check_size == __Pyx_ImportType_CheckSize_Warn_0_29_36 && (
size_t)basicsize > size) {
24600 PyOS_snprintf(warning,
sizeof(warning),
24601 "%s.%s size changed, may indicate binary incompatibility. "
24602 "Expected %zd from C header, got %zd from PyObject",
24603 module_name, class_name, size, basicsize);
24604 if (PyErr_WarnEx(NULL, warning, 0) < 0)
goto bad;
24606 return (PyTypeObject *)result;
24608 Py_XDECREF(result);
24614 static void* __Pyx_GetVtable(PyObject *dict) {
24616 PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
24619 #if PY_VERSION_HEX >= 0x02070000
24620 ptr = PyCapsule_GetPointer(ob, 0);
24622 ptr = PyCObject_AsVoidPtr(ob);
24624 if (!ptr && !PyErr_Occurred())
24625 PyErr_SetString(PyExc_RuntimeError,
"invalid vtable found for imported type");
24634 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
24635 PyObject* fake_module;
24636 PyTypeObject* cached_type = NULL;
24637 fake_module = PyImport_AddModule((
char*)
"_cython_" CYTHON_ABI);
24638 if (!fake_module)
return NULL;
24639 Py_INCREF(fake_module);
24640 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
24642 if (!PyType_Check((PyObject*)cached_type)) {
24643 PyErr_Format(PyExc_TypeError,
24644 "Shared Cython type %.200s is not a type object",
24648 if (cached_type->tp_basicsize != type->tp_basicsize) {
24649 PyErr_Format(PyExc_TypeError,
24650 "Shared Cython type %.200s has the wrong size, try recompiling",
24655 if (!PyErr_ExceptionMatches(PyExc_AttributeError))
goto bad;
24657 if (PyType_Ready(type) < 0)
goto bad;
24658 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
24661 cached_type = type;
24664 Py_DECREF(fake_module);
24665 return cached_type;
24667 Py_XDECREF(cached_type);
24668 cached_type = NULL;
24673 #include <structmember.h>
24675 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *closure)
24677 if (unlikely(op->func_doc == NULL)) {
24678 if (op->func.m_ml->ml_doc) {
24679 #if PY_MAJOR_VERSION >= 3
24680 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
24682 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
24684 if (unlikely(op->func_doc == NULL))
24687 Py_INCREF(Py_None);
24691 Py_INCREF(op->func_doc);
24692 return op->func_doc;
24695 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24697 PyObject *tmp = op->func_doc;
24698 if (value == NULL) {
24702 op->func_doc = value;
24707 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24709 if (unlikely(op->func_name == NULL)) {
24710 #if PY_MAJOR_VERSION >= 3
24711 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
24713 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
24715 if (unlikely(op->func_name == NULL))
24718 Py_INCREF(op->func_name);
24719 return op->func_name;
24722 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24725 #if PY_MAJOR_VERSION >= 3
24726 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24728 if (unlikely(value == NULL || !PyString_Check(value)))
24731 PyErr_SetString(PyExc_TypeError,
24732 "__name__ must be set to a string object");
24735 tmp = op->func_name;
24737 op->func_name = value;
24742 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24744 Py_INCREF(op->func_qualname);
24745 return op->func_qualname;
24748 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24751 #if PY_MAJOR_VERSION >= 3
24752 if (unlikely(value == NULL || !PyUnicode_Check(value)))
24754 if (unlikely(value == NULL || !PyString_Check(value)))
24757 PyErr_SetString(PyExc_TypeError,
24758 "__qualname__ must be set to a string object");
24761 tmp = op->func_qualname;
24763 op->func_qualname = value;
24768 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED
void *closure)
24771 self = m->func_closure;
24778 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24780 if (unlikely(op->func_dict == NULL)) {
24781 op->func_dict = PyDict_New();
24782 if (unlikely(op->func_dict == NULL))
24785 Py_INCREF(op->func_dict);
24786 return op->func_dict;
24789 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value, CYTHON_UNUSED
void *context)
24792 if (unlikely(value == NULL)) {
24793 PyErr_SetString(PyExc_TypeError,
24794 "function's dictionary may not be deleted");
24797 if (unlikely(!PyDict_Check(value))) {
24798 PyErr_SetString(PyExc_TypeError,
24799 "setting function's dictionary to a non-dict");
24802 tmp = op->func_dict;
24804 op->func_dict = value;
24809 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24811 Py_INCREF(op->func_globals);
24812 return op->func_globals;
24815 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24817 Py_INCREF(Py_None);
24821 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context)
24823 PyObject* result = (op->func_code) ? op->func_code : Py_None;
24828 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
24830 PyObject *res = op->defaults_getter((PyObject *) op);
24831 if (unlikely(!res))
24833 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
24834 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
24835 Py_INCREF(op->defaults_tuple);
24836 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
24837 Py_INCREF(op->defaults_kwdict);
24839 op->defaults_tuple = PySequence_ITEM(res, 0);
24840 if (unlikely(!op->defaults_tuple)) result = -1;
24842 op->defaults_kwdict = PySequence_ITEM(res, 1);
24843 if (unlikely(!op->defaults_kwdict)) result = -1;
24850 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24854 }
else if (value != Py_None && !PyTuple_Check(value)) {
24855 PyErr_SetString(PyExc_TypeError,
24856 "__defaults__ must be set to a tuple object");
24860 tmp = op->defaults_tuple;
24861 op->defaults_tuple = value;
24866 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24867 PyObject* result = op->defaults_tuple;
24868 if (unlikely(!result)) {
24869 if (op->defaults_getter) {
24870 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24871 result = op->defaults_tuple;
24880 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24884 }
else if (value != Py_None && !PyDict_Check(value)) {
24885 PyErr_SetString(PyExc_TypeError,
24886 "__kwdefaults__ must be set to a dict object");
24890 tmp = op->defaults_kwdict;
24891 op->defaults_kwdict = value;
24896 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24897 PyObject* result = op->defaults_kwdict;
24898 if (unlikely(!result)) {
24899 if (op->defaults_getter) {
24900 if (__Pyx_CyFunction_init_defaults(op) < 0)
return NULL;
24901 result = op->defaults_kwdict;
24910 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value, CYTHON_UNUSED
void *context) {
24912 if (!value || value == Py_None) {
24914 }
else if (!PyDict_Check(value)) {
24915 PyErr_SetString(PyExc_TypeError,
24916 "__annotations__ must be set to a dict object");
24920 tmp = op->func_annotations;
24921 op->func_annotations = value;
24926 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op, CYTHON_UNUSED
void *context) {
24927 PyObject* result = op->func_annotations;
24928 if (unlikely(!result)) {
24929 result = PyDict_New();
24930 if (unlikely(!result))
return NULL;
24931 op->func_annotations = result;
24936 static PyGetSetDef __pyx_CyFunction_getsets[] = {
24937 {(
char *)
"func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24938 {(
char *)
"__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
24939 {(
char *)
"func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24940 {(
char *)
"__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
24941 {(
char *)
"__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
24942 {(
char *)
"__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
24943 {(
char *)
"func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24944 {(
char *)
"__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
24945 {(
char *)
"func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24946 {(
char *)
"__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
24947 {(
char *)
"func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24948 {(
char *)
"__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
24949 {(
char *)
"func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24950 {(
char *)
"__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
24951 {(
char *)
"func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24952 {(
char *)
"__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
24953 {(
char *)
"__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
24954 {(
char *)
"__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
24957 static PyMemberDef __pyx_CyFunction_members[] = {
24958 {(
char *)
"__module__", T_OBJECT, offsetof(PyCFunctionObject, m_module), PY_WRITE_RESTRICTED, 0},
24962 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
24964 #if PY_MAJOR_VERSION >= 3
24965 Py_INCREF(m->func_qualname);
24966 return m->func_qualname;
24968 return PyString_FromString(m->func.m_ml->ml_name);
24971 static PyMethodDef __pyx_CyFunction_methods[] = {
24972 {
"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
24975 #if PY_VERSION_HEX < 0x030500A0
24976 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
24978 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
24980 static PyObject *__Pyx_CyFunction_Init(__pyx_CyFunctionObject *op, PyMethodDef *ml,
int flags, PyObject* qualname,
24981 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
24982 if (unlikely(op == NULL))
24985 __Pyx_CyFunction_weakreflist(op) = NULL;
24986 op->func.m_ml = ml;
24987 op->func.m_self = (PyObject *) op;
24988 Py_XINCREF(closure);
24989 op->func_closure = closure;
24990 Py_XINCREF(module);
24991 op->func.m_module = module;
24992 op->func_dict = NULL;
24993 op->func_name = NULL;
24994 Py_INCREF(qualname);
24995 op->func_qualname = qualname;
24996 op->func_doc = NULL;
24997 op->func_classobj = NULL;
24998 op->func_globals = globals;
24999 Py_INCREF(op->func_globals);
25001 op->func_code = code;
25002 op->defaults_pyobjects = 0;
25003 op->defaults_size = 0;
25004 op->defaults = NULL;
25005 op->defaults_tuple = NULL;
25006 op->defaults_kwdict = NULL;
25007 op->defaults_getter = NULL;
25008 op->func_annotations = NULL;
25009 return (PyObject *) op;
25012 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
25014 Py_CLEAR(m->func_closure);
25015 Py_CLEAR(m->func.m_module);
25016 Py_CLEAR(m->func_dict);
25017 Py_CLEAR(m->func_name);
25018 Py_CLEAR(m->func_qualname);
25019 Py_CLEAR(m->func_doc);
25020 Py_CLEAR(m->func_globals);
25021 Py_CLEAR(m->func_code);
25022 Py_CLEAR(m->func_classobj);
25023 Py_CLEAR(m->defaults_tuple);
25024 Py_CLEAR(m->defaults_kwdict);
25025 Py_CLEAR(m->func_annotations);
25027 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25029 for (i = 0; i < m->defaults_pyobjects; i++)
25030 Py_XDECREF(pydefaults[i]);
25031 PyObject_Free(m->defaults);
25032 m->defaults = NULL;
25036 static void __Pyx__CyFunction_dealloc(__pyx_CyFunctionObject *m)
25038 if (__Pyx_CyFunction_weakreflist(m) != NULL)
25039 PyObject_ClearWeakRefs((PyObject *) m);
25040 __Pyx_CyFunction_clear(m);
25041 PyObject_GC_Del(m);
25043 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
25045 PyObject_GC_UnTrack(m);
25046 __Pyx__CyFunction_dealloc(m);
25048 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit,
void *arg)
25050 Py_VISIT(m->func_closure);
25051 Py_VISIT(m->func.m_module);
25052 Py_VISIT(m->func_dict);
25053 Py_VISIT(m->func_name);
25054 Py_VISIT(m->func_qualname);
25055 Py_VISIT(m->func_doc);
25056 Py_VISIT(m->func_globals);
25057 Py_VISIT(m->func_code);
25058 Py_VISIT(m->func_classobj);
25059 Py_VISIT(m->defaults_tuple);
25060 Py_VISIT(m->defaults_kwdict);
25062 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
25064 for (i = 0; i < m->defaults_pyobjects; i++)
25065 Py_VISIT(pydefaults[i]);
25069 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
25071 #if PY_MAJOR_VERSION < 3
25072 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25073 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
25077 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
25079 type = (PyObject *)(Py_TYPE(obj));
25080 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
25082 if (obj == Py_None)
25085 return __Pyx_PyMethod_New(func, obj, type);
25088 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
25090 #if PY_MAJOR_VERSION >= 3
25091 return PyUnicode_FromFormat(
"<cyfunction %U at %p>",
25092 op->func_qualname, (
void *)op);
25094 return PyString_FromFormat(
"<cyfunction %s at %p>",
25095 PyString_AsString(op->func_qualname), (
void *)op);
25098 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *
self, PyObject *arg, PyObject *kw) {
25099 PyCFunctionObject* f = (PyCFunctionObject*)func;
25100 PyCFunction meth = f->m_ml->ml_meth;
25102 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
25104 if (likely(kw == NULL || PyDict_Size(kw) == 0))
25105 return (*meth)(
self, arg);
25107 case METH_VARARGS | METH_KEYWORDS:
25108 return (*(PyCFunctionWithKeywords)(
void*)meth)(
self, arg, kw);
25110 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25111 size = PyTuple_GET_SIZE(arg);
25112 if (likely(size == 0))
25113 return (*meth)(
self, NULL);
25114 PyErr_Format(PyExc_TypeError,
25115 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25116 f->m_ml->ml_name, size);
25121 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
25122 size = PyTuple_GET_SIZE(arg);
25123 if (likely(size == 1)) {
25124 PyObject *result, *arg0;
25125 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
25126 arg0 = PyTuple_GET_ITEM(arg, 0);
25128 arg0 = PySequence_ITEM(arg, 0);
if (unlikely(!arg0))
return NULL;
25130 result = (*meth)(
self, arg0);
25131 #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS)
25136 PyErr_Format(PyExc_TypeError,
25137 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T
"d given)",
25138 f->m_ml->ml_name, size);
25143 PyErr_SetString(PyExc_SystemError,
"Bad call flags in "
25144 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
25145 "longer supported!");
25148 PyErr_Format(PyExc_TypeError,
"%.200s() takes no keyword arguments",
25152 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
25153 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
25155 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
25157 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
25158 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
25160 PyObject *new_args;
25162 argc = PyTuple_GET_SIZE(args);
25163 new_args = PyTuple_GetSlice(args, 1, argc);
25164 if (unlikely(!new_args))
25166 self = PyTuple_GetItem(args, 0);
25167 if (unlikely(!
self)) {
25168 Py_DECREF(new_args);
25169 #if PY_MAJOR_VERSION > 2
25170 PyErr_Format(PyExc_TypeError,
25171 "unbound method %.200S() needs an argument",
25172 cyfunc->func_qualname);
25174 PyErr_SetString(PyExc_TypeError,
25175 "unbound method needs an argument");
25179 result = __Pyx_CyFunction_CallMethod(func,
self, new_args, kw);
25180 Py_DECREF(new_args);
25182 result = __Pyx_CyFunction_Call(func, args, kw);
25186 static PyTypeObject __pyx_CyFunctionType_type = {
25187 PyVarObject_HEAD_INIT(0, 0)
25188 "cython_function_or_method",
25189 sizeof(__pyx_CyFunctionObject),
25191 (destructor) __Pyx_CyFunction_dealloc,
25195 #if PY_MAJOR_VERSION < 3
25200 (reprfunc) __Pyx_CyFunction_repr,
25205 __Pyx_CyFunction_CallAsMethod,
25210 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
25212 (traverseproc) __Pyx_CyFunction_traverse,
25213 (inquiry) __Pyx_CyFunction_clear,
25215 #
if PY_VERSION_HEX < 0x030500A0
25216 offsetof(__pyx_CyFunctionObject, func_weakreflist),
25218 offsetof(PyCFunctionObject, m_weakreflist),
25222 __pyx_CyFunction_methods,
25223 __pyx_CyFunction_members,
25224 __pyx_CyFunction_getsets,
25227 __Pyx_CyFunction_descr_get,
25229 offsetof(__pyx_CyFunctionObject, func_dict),
25242 #if PY_VERSION_HEX >= 0x030400a1
25245 #if PY_VERSION_HEX >= 0x030800b1 && (!CYTHON_COMPILING_IN_PYPY || PYPY_VERSION_NUM >= 0x07030800)
25248 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
25251 #if PY_VERSION_HEX >= 0x030C0000
25254 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX >= 0x03090000 && PY_VERSION_HEX < 0x030a0000
25258 static int __pyx_CyFunction_init(
void) {
25259 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
25260 if (unlikely(__pyx_CyFunctionType == NULL)) {
25265 static CYTHON_INLINE
void *__Pyx_CyFunction_InitDefaults(PyObject *func,
size_t size,
int pyobjects) {
25266 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25267 m->defaults = PyObject_Malloc(size);
25268 if (unlikely(!m->defaults))
25269 return PyErr_NoMemory();
25270 memset(m->defaults, 0, size);
25271 m->defaults_pyobjects = pyobjects;
25272 m->defaults_size = size;
25273 return m->defaults;
25275 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
25276 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25277 m->defaults_tuple = tuple;
25280 static CYTHON_INLINE
void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
25281 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25282 m->defaults_kwdict = dict;
25285 static CYTHON_INLINE
void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
25286 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
25287 m->func_annotations = dict;
25292 static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml,
int flags, PyObject* qualname,
25293 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
25294 PyObject *op = __Pyx_CyFunction_Init(
25295 PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType),
25296 ml, flags, qualname, closure, module, globals, code
25299 PyObject_GC_Track(op);
25305 #ifndef CYTHON_CLINE_IN_TRACEBACK
25306 static int __Pyx_CLineForTraceback(CYTHON_UNUSED PyThreadState *tstate,
int c_line) {
25307 PyObject *use_cline;
25308 PyObject *ptype, *pvalue, *ptraceback;
25309 #if CYTHON_COMPILING_IN_CPYTHON
25310 PyObject **cython_runtime_dict;
25312 if (unlikely(!__pyx_cython_runtime)) {
25315 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25316 #if CYTHON_COMPILING_IN_CPYTHON
25317 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
25318 if (likely(cython_runtime_dict)) {
25319 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
25320 use_cline, *cython_runtime_dict,
25321 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
25325 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
25326 if (use_cline_obj) {
25327 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
25328 Py_DECREF(use_cline_obj);
25336 (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
25338 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
25341 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25347 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries,
int count,
int code_line) {
25348 int start = 0, mid = 0, end = count - 1;
25349 if (end >= 0 && code_line > entries[end].code_line) {
25352 while (start < end) {
25353 mid = start + (end - start) / 2;
25354 if (code_line < entries[mid].code_line) {
25356 }
else if (code_line > entries[mid].code_line) {
25362 if (code_line <= entries[mid].code_line) {
25368 static PyCodeObject *__pyx_find_code_object(
int code_line) {
25369 PyCodeObject* code_object;
25371 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
25374 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25375 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
25378 code_object = __pyx_code_cache.entries[pos].code_object;
25379 Py_INCREF(code_object);
25380 return code_object;
25382 static void __pyx_insert_code_object(
int code_line, PyCodeObject* code_object) {
25384 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
25385 if (unlikely(!code_line)) {
25388 if (unlikely(!entries)) {
25389 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*
sizeof(__Pyx_CodeObjectCacheEntry));
25390 if (likely(entries)) {
25391 __pyx_code_cache.entries = entries;
25392 __pyx_code_cache.max_count = 64;
25393 __pyx_code_cache.count = 1;
25394 entries[0].code_line = code_line;
25395 entries[0].code_object = code_object;
25396 Py_INCREF(code_object);
25400 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
25401 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
25402 PyCodeObject* tmp = entries[pos].code_object;
25403 entries[pos].code_object = code_object;
25407 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
25408 int new_max = __pyx_code_cache.max_count + 64;
25409 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
25410 __pyx_code_cache.entries, ((
size_t)new_max) *
sizeof(__Pyx_CodeObjectCacheEntry));
25411 if (unlikely(!entries)) {
25414 __pyx_code_cache.entries = entries;
25415 __pyx_code_cache.max_count = new_max;
25417 for (i=__pyx_code_cache.count; i>pos; i--) {
25418 entries[i] = entries[i-1];
25420 entries[pos].code_line = code_line;
25421 entries[pos].code_object = code_object;
25422 __pyx_code_cache.count++;
25423 Py_INCREF(code_object);
25427 #include "compile.h"
25428 #include "frameobject.h"
25429 #include "traceback.h"
25430 #if PY_VERSION_HEX >= 0x030b00a6
25431 #ifndef Py_BUILD_CORE
25432 #define Py_BUILD_CORE 1
25434 #include "internal/pycore_frame.h"
25436 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
25437 const char *funcname,
int c_line,
25438 int py_line,
const char *filename) {
25439 PyCodeObject *py_code = NULL;
25440 PyObject *py_funcname = NULL;
25441 #if PY_MAJOR_VERSION < 3
25442 PyObject *py_srcfile = NULL;
25443 py_srcfile = PyString_FromString(filename);
25444 if (!py_srcfile)
goto bad;
25447 #if PY_MAJOR_VERSION < 3
25448 py_funcname = PyString_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25449 if (!py_funcname)
goto bad;
25451 py_funcname = PyUnicode_FromFormat(
"%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
25452 if (!py_funcname)
goto bad;
25453 funcname = PyUnicode_AsUTF8(py_funcname);
25454 if (!funcname)
goto bad;
25458 #if PY_MAJOR_VERSION < 3
25459 py_funcname = PyString_FromString(funcname);
25460 if (!py_funcname)
goto bad;
25463 #if PY_MAJOR_VERSION < 3
25464 py_code = __Pyx_PyCode_New(
25481 Py_DECREF(py_srcfile);
25483 py_code = PyCode_NewEmpty(filename, funcname, py_line);
25485 Py_XDECREF(py_funcname);
25488 Py_XDECREF(py_funcname);
25489 #if PY_MAJOR_VERSION < 3
25490 Py_XDECREF(py_srcfile);
25494 static void __Pyx_AddTraceback(
const char *funcname,
int c_line,
25495 int py_line,
const char *filename) {
25496 PyCodeObject *py_code = 0;
25497 PyFrameObject *py_frame = 0;
25498 PyThreadState *tstate = __Pyx_PyThreadState_Current;
25499 PyObject *ptype, *pvalue, *ptraceback;
25501 c_line = __Pyx_CLineForTraceback(tstate, c_line);
25503 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
25505 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
25506 py_code = __Pyx_CreateCodeObjectForTraceback(
25507 funcname, c_line, py_line, filename);
25512 Py_XDECREF(pvalue);
25513 Py_XDECREF(ptraceback);
25516 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
25517 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
25519 py_frame = PyFrame_New(
25525 if (!py_frame)
goto bad;
25526 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
25527 PyTraceBack_Here(py_frame);
25529 Py_XDECREF(py_code);
25530 Py_XDECREF(py_frame);
25533 #if PY_MAJOR_VERSION < 3
25534 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view,
int flags) {
25535 if (PyObject_CheckBuffer(obj))
return PyObject_GetBuffer(obj, view, flags);
25536 if (__Pyx_TypeCheck(obj, __pyx_array_type))
return __pyx_array_getbuffer(obj, view, flags);
25537 if (__Pyx_TypeCheck(obj, __pyx_memoryview_type))
return __pyx_memoryview_getbuffer(obj, view, flags);
25538 PyErr_Format(PyExc_TypeError,
"'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
25541 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
25542 PyObject *obj = view->obj;
25544 if (PyObject_CheckBuffer(obj)) {
25545 PyBuffer_Release(view);
25557 __pyx_memviewslice_is_contig(
const __Pyx_memviewslice mvs,
char order,
int ndim)
25559 int i, index, step, start;
25560 Py_ssize_t itemsize = mvs.memview->view.itemsize;
25561 if (order ==
'F') {
25568 for (i = 0; i < ndim; i++) {
25569 index = start + step * i;
25570 if (mvs.suboffsets[index] >= 0 || mvs.strides[index] != itemsize)
25572 itemsize *= mvs.shape[index];
25579 __pyx_get_array_memory_extents(__Pyx_memviewslice *slice,
25580 void **out_start,
void **out_end,
25581 int ndim,
size_t itemsize)
25585 start = end = slice->data;
25586 for (i = 0; i < ndim; i++) {
25587 Py_ssize_t stride = slice->strides[i];
25588 Py_ssize_t extent = slice->shape[i];
25590 *out_start = *out_end = start;
25594 end += stride * (extent - 1);
25596 start += stride * (extent - 1);
25599 *out_start = start;
25600 *out_end = end + itemsize;
25603 __pyx_slices_overlap(__Pyx_memviewslice *slice1,
25604 __Pyx_memviewslice *slice2,
25605 int ndim,
size_t itemsize)
25607 void *start1, *end1, *start2, *end2;
25608 __pyx_get_array_memory_extents(slice1, &start1, &end1, ndim, itemsize);
25609 __pyx_get_array_memory_extents(slice2, &start2, &end2, ndim, itemsize);
25610 return (start1 < end2) && (start2 < end1);
25614 static CYTHON_INLINE PyObject *
25615 __pyx_capsule_create(
void *p, CYTHON_UNUSED
const char *sig)
25618 #if PY_VERSION_HEX >= 0x02070000
25619 cobj = PyCapsule_New(p, sig, NULL);
25621 cobj = PyCObject_FromVoidPtr(p, NULL);
25627 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
25628 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
25629 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
25630 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
25631 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
25633 func_type value = func_value;\
25634 if (sizeof(target_type) < sizeof(func_type)) {\
25635 if (unlikely(value != (func_type) (target_type) value)) {\
25636 func_type zero = 0;\
25637 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
25638 return (target_type) -1;\
25639 if (is_unsigned && unlikely(value < zero))\
25640 goto raise_neg_overflow;\
25642 goto raise_overflow;\
25645 return (target_type) value;\
25649 static CYTHON_INLINE
int __Pyx_Is_Little_Endian(
void)
25655 S.u32 = 0x01020304;
25656 return S.u8[0] == 4;
25660 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
25661 __Pyx_BufFmt_StackElem* stack,
25662 __Pyx_TypeInfo* type) {
25663 stack[0].field = &ctx->root;
25664 stack[0].parent_offset = 0;
25665 ctx->root.type = type;
25666 ctx->root.name =
"buffer dtype";
25667 ctx->root.offset = 0;
25669 ctx->head->field = &ctx->root;
25670 ctx->fmt_offset = 0;
25671 ctx->head->parent_offset = 0;
25672 ctx->new_packmode =
'@';
25673 ctx->enc_packmode =
'@';
25674 ctx->new_count = 1;
25675 ctx->enc_count = 0;
25677 ctx->is_complex = 0;
25678 ctx->is_valid_array = 0;
25679 ctx->struct_alignment = 0;
25680 while (type->typegroup ==
'S') {
25682 ctx->head->field = type->fields;
25683 ctx->head->parent_offset = 0;
25684 type = type->fields->type;
25687 static int __Pyx_BufFmt_ParseNumber(
const char** ts) {
25689 const char* t = *ts;
25690 if (*t < '0' || *t >
'9') {
25693 count = *t++ -
'0';
25694 while (*t >=
'0' && *t <=
'9') {
25696 count += *t++ -
'0';
25702 static int __Pyx_BufFmt_ExpectNumber(
const char **ts) {
25703 int number = __Pyx_BufFmt_ParseNumber(ts);
25705 PyErr_Format(PyExc_ValueError,\
25706 "Does not understand character buffer dtype format string ('%c')", **ts);
25709 static void __Pyx_BufFmt_RaiseUnexpectedChar(
char ch) {
25710 PyErr_Format(PyExc_ValueError,
25711 "Unexpected format string character: '%c'", ch);
25713 static const char* __Pyx_BufFmt_DescribeTypeChar(
char ch,
int is_complex) {
25715 case '?':
return "'bool'";
25716 case 'c':
return "'char'";
25717 case 'b':
return "'signed char'";
25718 case 'B':
return "'unsigned char'";
25719 case 'h':
return "'short'";
25720 case 'H':
return "'unsigned short'";
25721 case 'i':
return "'int'";
25722 case 'I':
return "'unsigned int'";
25723 case 'l':
return "'long'";
25724 case 'L':
return "'unsigned long'";
25725 case 'q':
return "'long long'";
25726 case 'Q':
return "'unsigned long long'";
25727 case 'f':
return (is_complex ?
"'complex float'" :
"'float'");
25728 case 'd':
return (is_complex ?
"'complex double'" :
"'double'");
25729 case 'g':
return (is_complex ?
"'complex long double'" :
"'long double'");
25730 case 'T':
return "a struct";
25731 case 'O':
return "Python object";
25732 case 'P':
return "a pointer";
25733 case 's':
case 'p':
return "a string";
25734 case 0:
return "end";
25735 default:
return "unparseable format string";
25738 static size_t __Pyx_BufFmt_TypeCharToStandardSize(
char ch,
int is_complex) {
25740 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25741 case 'h':
case 'H':
return 2;
25742 case 'i':
case 'I':
case 'l':
case 'L':
return 4;
25743 case 'q':
case 'Q':
return 8;
25744 case 'f':
return (is_complex ? 8 : 4);
25745 case 'd':
return (is_complex ? 16 : 8);
25747 PyErr_SetString(PyExc_ValueError,
"Python does not define a standard format string size for long double ('g')..");
25750 case 'O':
case 'P':
return sizeof(
void*);
25752 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25756 static size_t __Pyx_BufFmt_TypeCharToNativeSize(
char ch,
int is_complex) {
25758 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25759 case 'h':
case 'H':
return sizeof(short);
25760 case 'i':
case 'I':
return sizeof(int);
25761 case 'l':
case 'L':
return sizeof(long);
25762 #ifdef HAVE_LONG_LONG
25763 case 'q':
case 'Q':
return sizeof(PY_LONG_LONG);
25765 case 'f':
return sizeof(float) * (is_complex ? 2 : 1);
25766 case 'd':
return sizeof(double) * (is_complex ? 2 : 1);
25767 case 'g':
return sizeof(
long double) * (is_complex ? 2 : 1);
25768 case 'O':
case 'P':
return sizeof(
void*);
25770 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25775 typedef struct {
char c;
short x; } __Pyx_st_short;
25776 typedef struct {
char c;
int x; } __Pyx_st_int;
25777 typedef struct {
char c;
long x; } __Pyx_st_long;
25778 typedef struct {
char c;
float x; } __Pyx_st_float;
25779 typedef struct {
char c;
double x; } __Pyx_st_double;
25780 typedef struct {
char c;
long double x; } __Pyx_st_longdouble;
25781 typedef struct {
char c;
void *x; } __Pyx_st_void_p;
25782 #ifdef HAVE_LONG_LONG
25783 typedef struct {
char c; PY_LONG_LONG x; } __Pyx_st_longlong;
25785 static size_t __Pyx_BufFmt_TypeCharToAlignment(
char ch, CYTHON_UNUSED
int is_complex) {
25787 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25788 case 'h':
case 'H':
return sizeof(__Pyx_st_short) -
sizeof(
short);
25789 case 'i':
case 'I':
return sizeof(__Pyx_st_int) -
sizeof(
int);
25790 case 'l':
case 'L':
return sizeof(__Pyx_st_long) -
sizeof(
long);
25791 #ifdef HAVE_LONG_LONG
25792 case 'q':
case 'Q':
return sizeof(__Pyx_st_longlong) -
sizeof(PY_LONG_LONG);
25794 case 'f':
return sizeof(__Pyx_st_float) -
sizeof(
float);
25795 case 'd':
return sizeof(__Pyx_st_double) -
sizeof(
double);
25796 case 'g':
return sizeof(__Pyx_st_longdouble) -
sizeof(
long double);
25797 case 'P':
case 'O':
return sizeof(__Pyx_st_void_p) -
sizeof(
void*);
25799 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25807 typedef struct {
short x;
char c; } __Pyx_pad_short;
25808 typedef struct {
int x;
char c; } __Pyx_pad_int;
25809 typedef struct {
long x;
char c; } __Pyx_pad_long;
25810 typedef struct {
float x;
char c; } __Pyx_pad_float;
25811 typedef struct {
double x;
char c; } __Pyx_pad_double;
25812 typedef struct {
long double x;
char c; } __Pyx_pad_longdouble;
25813 typedef struct {
void *x;
char c; } __Pyx_pad_void_p;
25814 #ifdef HAVE_LONG_LONG
25815 typedef struct { PY_LONG_LONG x;
char c; } __Pyx_pad_longlong;
25817 static size_t __Pyx_BufFmt_TypeCharToPadding(
char ch, CYTHON_UNUSED
int is_complex) {
25819 case '?':
case 'c':
case 'b':
case 'B':
case 's':
case 'p':
return 1;
25820 case 'h':
case 'H':
return sizeof(__Pyx_pad_short) -
sizeof(
short);
25821 case 'i':
case 'I':
return sizeof(__Pyx_pad_int) -
sizeof(
int);
25822 case 'l':
case 'L':
return sizeof(__Pyx_pad_long) -
sizeof(
long);
25823 #ifdef HAVE_LONG_LONG
25824 case 'q':
case 'Q':
return sizeof(__Pyx_pad_longlong) -
sizeof(PY_LONG_LONG);
25826 case 'f':
return sizeof(__Pyx_pad_float) -
sizeof(
float);
25827 case 'd':
return sizeof(__Pyx_pad_double) -
sizeof(
double);
25828 case 'g':
return sizeof(__Pyx_pad_longdouble) -
sizeof(
long double);
25829 case 'P':
case 'O':
return sizeof(__Pyx_pad_void_p) -
sizeof(
void*);
25831 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25835 static char __Pyx_BufFmt_TypeCharToGroup(
char ch,
int is_complex) {
25839 case 'b':
case 'h':
case 'i':
25840 case 'l':
case 'q':
case 's':
case 'p':
25842 case '?':
case 'B':
case 'H':
case 'I':
case 'L':
case 'Q':
25844 case 'f':
case 'd':
case 'g':
25845 return (is_complex ?
'C' :
'R');
25851 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
25856 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
25857 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
25858 const char* expected;
25860 if (ctx->head == NULL) {
25864 expected = ctx->head->field->type->name;
25867 PyErr_Format(PyExc_ValueError,
25868 "Buffer dtype mismatch, expected %s%s%s but got %s",
25869 quote, expected, quote,
25870 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
25872 __Pyx_StructField* field = ctx->head->field;
25873 __Pyx_StructField* parent = (ctx->head - 1)->field;
25874 PyErr_Format(PyExc_ValueError,
25875 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
25876 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
25877 parent->type->name, field->name);
25880 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
25882 size_t size, offset, arraysize = 1;
25883 if (ctx->enc_type == 0)
return 0;
25884 if (ctx->head->field->type->arraysize[0]) {
25886 if (ctx->enc_type ==
's' || ctx->enc_type ==
'p') {
25887 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
25889 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
25890 PyErr_Format(PyExc_ValueError,
25891 "Expected a dimension of size %zu, got %zu",
25892 ctx->head->field->type->arraysize[0], ctx->enc_count);
25896 if (!ctx->is_valid_array) {
25897 PyErr_Format(PyExc_ValueError,
"Expected %d dimensions, got %d",
25898 ctx->head->field->type->ndim, ndim);
25901 for (i = 0; i < ctx->head->field->type->ndim; i++) {
25902 arraysize *= ctx->head->field->type->arraysize[i];
25904 ctx->is_valid_array = 0;
25905 ctx->enc_count = 1;
25907 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
25909 __Pyx_StructField* field = ctx->head->field;
25910 __Pyx_TypeInfo* type = field->type;
25911 if (ctx->enc_packmode ==
'@' || ctx->enc_packmode ==
'^') {
25912 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
25914 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
25916 if (ctx->enc_packmode ==
'@') {
25917 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
25918 size_t align_mod_offset;
25919 if (align_at == 0)
return -1;
25920 align_mod_offset = ctx->fmt_offset % align_at;
25921 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
25922 if (ctx->struct_alignment == 0)
25923 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
25926 if (type->size != size || type->typegroup != group) {
25927 if (type->typegroup ==
'C' && type->fields != NULL) {
25928 size_t parent_offset = ctx->head->parent_offset + field->offset;
25930 ctx->head->field = type->fields;
25931 ctx->head->parent_offset = parent_offset;
25934 if ((type->typegroup ==
'H' || group ==
'H') && type->size == size) {
25936 __Pyx_BufFmt_RaiseExpected(ctx);
25940 offset = ctx->head->parent_offset + field->offset;
25941 if (ctx->fmt_offset != offset) {
25942 PyErr_Format(PyExc_ValueError,
25943 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T
"d but %" CYTHON_FORMAT_SSIZE_T
"d expected",
25944 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
25947 ctx->fmt_offset += size;
25949 ctx->fmt_offset += (arraysize - 1) * size;
25952 if (field == &ctx->root) {
25954 if (ctx->enc_count != 0) {
25955 __Pyx_BufFmt_RaiseExpected(ctx);
25960 ctx->head->field = ++field;
25961 if (field->type == NULL) {
25963 field = ctx->head->field;
25965 }
else if (field->type->typegroup ==
'S') {
25966 size_t parent_offset = ctx->head->parent_offset + field->offset;
25967 if (field->type->fields->type == NULL)
continue;
25968 field = field->type->fields;
25970 ctx->head->field = field;
25971 ctx->head->parent_offset = parent_offset;
25977 }
while (ctx->enc_count);
25979 ctx->is_complex = 0;
25983 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx,
const char** tsp)
25985 const char *ts = *tsp;
25986 int i = 0, number, ndim;
25988 if (ctx->new_count != 1) {
25989 PyErr_SetString(PyExc_ValueError,
25990 "Cannot handle repeated arrays in format string");
25993 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
25994 ndim = ctx->head->field->type->ndim;
25995 while (*ts && *ts !=
')') {
25997 case ' ':
case '\f':
case '\r':
case '\n':
case '\t':
case '\v':
continue;
26000 number = __Pyx_BufFmt_ExpectNumber(&ts);
26001 if (number == -1)
return NULL;
26002 if (i < ndim && (
size_t) number != ctx->head->field->type->arraysize[i])
26003 return PyErr_Format(PyExc_ValueError,
26004 "Expected a dimension of size %zu, got %d",
26005 ctx->head->field->type->arraysize[i], number);
26006 if (*ts !=
',' && *ts !=
')')
26007 return PyErr_Format(PyExc_ValueError,
26008 "Expected a comma in format string, got '%c'", *ts);
26009 if (*ts ==
',') ts++;
26013 return PyErr_Format(PyExc_ValueError,
"Expected %d dimension(s), got %d",
26014 ctx->head->field->type->ndim, i);
26016 PyErr_SetString(PyExc_ValueError,
26017 "Unexpected end of format string, expected ')'");
26020 ctx->is_valid_array = 1;
26021 ctx->new_count = 1;
26025 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx,
const char* ts) {
26030 if (ctx->enc_type != 0 && ctx->head == NULL) {
26031 __Pyx_BufFmt_RaiseExpected(ctx);
26034 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26035 if (ctx->head != NULL) {
26036 __Pyx_BufFmt_RaiseExpected(ctx);
26046 if (!__Pyx_Is_Little_Endian()) {
26047 PyErr_SetString(PyExc_ValueError,
"Little-endian buffer not supported on big-endian compiler");
26050 ctx->new_packmode =
'=';
26055 if (__Pyx_Is_Little_Endian()) {
26056 PyErr_SetString(PyExc_ValueError,
"Big-endian buffer not supported on little-endian compiler");
26059 ctx->new_packmode =
'=';
26065 ctx->new_packmode = *ts++;
26069 const char* ts_after_sub;
26070 size_t i, struct_count = ctx->new_count;
26071 size_t struct_alignment = ctx->struct_alignment;
26072 ctx->new_count = 1;
26075 PyErr_SetString(PyExc_ValueError,
"Buffer acquisition: Expected '{' after 'T'");
26078 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26080 ctx->enc_count = 0;
26081 ctx->struct_alignment = 0;
26084 for (i = 0; i != struct_count; ++i) {
26085 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
26086 if (!ts_after_sub)
return NULL;
26089 if (struct_alignment) ctx->struct_alignment = struct_alignment;
26094 size_t alignment = ctx->struct_alignment;
26096 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26098 if (alignment && ctx->fmt_offset % alignment) {
26099 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
26104 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26105 ctx->fmt_offset += ctx->new_count;
26106 ctx->new_count = 1;
26107 ctx->enc_count = 0;
26109 ctx->enc_packmode = ctx->new_packmode;
26115 if (*ts !=
'f' && *ts !=
'd' && *ts !=
'g') {
26116 __Pyx_BufFmt_RaiseUnexpectedChar(
'Z');
26119 CYTHON_FALLTHROUGH;
26120 case '?':
case 'c':
case 'b':
case 'B':
case 'h':
case 'H':
case 'i':
case 'I':
26121 case 'l':
case 'L':
case 'q':
case 'Q':
26122 case 'f':
case 'd':
case 'g':
26123 case 'O':
case 'p':
26124 if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) &&
26125 (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) {
26126 ctx->enc_count += ctx->new_count;
26127 ctx->new_count = 1;
26132 CYTHON_FALLTHROUGH;
26134 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1)
return NULL;
26135 ctx->enc_count = ctx->new_count;
26136 ctx->enc_packmode = ctx->new_packmode;
26137 ctx->enc_type = *ts;
26138 ctx->is_complex = got_Z;
26140 ctx->new_count = 1;
26145 while(*ts !=
':') ++ts;
26149 if (!__pyx_buffmt_parse_array(ctx, &ts))
return NULL;
26153 int number = __Pyx_BufFmt_ExpectNumber(&ts);
26154 if (number == -1)
return NULL;
26155 ctx->new_count = (size_t)number;
26163 __pyx_typeinfo_cmp(__Pyx_TypeInfo *a, __Pyx_TypeInfo *b)
26170 if (a->size != b->size || a->typegroup != b->typegroup ||
26171 a->is_unsigned != b->is_unsigned || a->ndim != b->ndim) {
26172 if (a->typegroup ==
'H' || b->typegroup ==
'H') {
26173 return a->size == b->size;
26179 for (i = 0; i < a->ndim; i++)
26180 if (a->arraysize[i] != b->arraysize[i])
26183 if (a->typegroup ==
'S') {
26184 if (a->flags != b->flags)
26186 if (a->fields || b->fields) {
26187 if (!(a->fields && b->fields))
26189 for (i = 0; a->fields[i].type && b->fields[i].type; i++) {
26190 __Pyx_StructField *field_a = a->fields + i;
26191 __Pyx_StructField *field_b = b->fields + i;
26192 if (field_a->offset != field_b->offset ||
26193 !__pyx_typeinfo_cmp(field_a->type, field_b->type))
26196 return !a->fields[i].type && !b->fields[i].type;
26204 __pyx_check_strides(Py_buffer *buf,
int dim,
int ndim,
int spec)
26206 if (buf->shape[dim] <= 1)
26208 if (buf->strides) {
26209 if (spec & __Pyx_MEMVIEW_CONTIG) {
26210 if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) {
26211 if (unlikely(buf->strides[dim] !=
sizeof(
void *))) {
26212 PyErr_Format(PyExc_ValueError,
26213 "Buffer is not indirectly contiguous "
26214 "in dimension %d.", dim);
26217 }
else if (unlikely(buf->strides[dim] != buf->itemsize)) {
26218 PyErr_SetString(PyExc_ValueError,
26219 "Buffer and memoryview are not contiguous "
26220 "in the same dimension.");
26224 if (spec & __Pyx_MEMVIEW_FOLLOW) {
26225 Py_ssize_t stride = buf->strides[dim];
26228 if (unlikely(stride < buf->itemsize)) {
26229 PyErr_SetString(PyExc_ValueError,
26230 "Buffer and memoryview are not contiguous "
26231 "in the same dimension.");
26236 if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) {
26237 PyErr_Format(PyExc_ValueError,
26238 "C-contiguous buffer is not contiguous in "
26239 "dimension %d", dim);
26241 }
else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) {
26242 PyErr_Format(PyExc_ValueError,
26243 "C-contiguous buffer is not indirect in "
26244 "dimension %d", dim);
26246 }
else if (unlikely(buf->suboffsets)) {
26247 PyErr_SetString(PyExc_ValueError,
26248 "Buffer exposes suboffsets but no strides");
26257 __pyx_check_suboffsets(Py_buffer *buf,
int dim, CYTHON_UNUSED
int ndim,
int spec)
26259 if (spec & __Pyx_MEMVIEW_DIRECT) {
26260 if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) {
26261 PyErr_Format(PyExc_ValueError,
26262 "Buffer not compatible with direct access "
26263 "in dimension %d.", dim);
26267 if (spec & __Pyx_MEMVIEW_PTR) {
26268 if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) {
26269 PyErr_Format(PyExc_ValueError,
26270 "Buffer is not indirectly accessible "
26271 "in dimension %d.", dim);
26280 __pyx_verify_contig(Py_buffer *buf,
int ndim,
int c_or_f_flag)
26283 if (c_or_f_flag & __Pyx_IS_F_CONTIG) {
26284 Py_ssize_t stride = 1;
26285 for (i = 0; i < ndim; i++) {
26286 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26287 PyErr_SetString(PyExc_ValueError,
26288 "Buffer not fortran contiguous.");
26291 stride = stride * buf->shape[i];
26293 }
else if (c_or_f_flag & __Pyx_IS_C_CONTIG) {
26294 Py_ssize_t stride = 1;
26295 for (i = ndim - 1; i >- 1; i--) {
26296 if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) {
26297 PyErr_SetString(PyExc_ValueError,
26298 "Buffer not C contiguous.");
26301 stride = stride * buf->shape[i];
26308 static int __Pyx_ValidateAndInit_memviewslice(
26313 __Pyx_TypeInfo *dtype,
26314 __Pyx_BufFmt_StackElem stack[],
26315 __Pyx_memviewslice *memviewslice,
26316 PyObject *original_obj)
26318 struct __pyx_memoryview_obj *memview, *new_memview;
26319 __Pyx_RefNannyDeclarations
26321 int i, spec = 0, retval = -1;
26322 __Pyx_BufFmt_Context ctx;
26323 int from_memoryview = __pyx_memoryview_check(original_obj);
26324 __Pyx_RefNannySetupContext(
"ValidateAndInit_memviewslice", 0);
26325 if (from_memoryview && __pyx_typeinfo_cmp(dtype, ((
struct __pyx_memoryview_obj *)
26326 original_obj)->typeinfo)) {
26327 memview = (
struct __pyx_memoryview_obj *) original_obj;
26328 new_memview = NULL;
26330 memview = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26331 original_obj, buf_flags, 0, dtype);
26332 new_memview = memview;
26333 if (unlikely(!memview))
26336 buf = &memview->view;
26337 if (unlikely(buf->ndim != ndim)) {
26338 PyErr_Format(PyExc_ValueError,
26339 "Buffer has wrong number of dimensions (expected %d, got %d)",
26344 __Pyx_BufFmt_Init(&ctx, stack, dtype);
26345 if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format)))
goto fail;
26347 if (unlikely((
unsigned) buf->itemsize != dtype->size)) {
26348 PyErr_Format(PyExc_ValueError,
26349 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T
"u byte%s) "
26350 "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T
"u byte%s)",
26352 (buf->itemsize > 1) ?
"s" :
"",
26355 (dtype->size > 1) ?
"s" :
"");
26358 if (buf->len > 0) {
26359 for (i = 0; i < ndim; i++) {
26360 spec = axes_specs[i];
26361 if (unlikely(!__pyx_check_strides(buf, i, ndim, spec)))
26363 if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec)))
26366 if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)))
26369 if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice,
26370 new_memview != NULL) == -1)) {
26376 Py_XDECREF(new_memview);
26379 __Pyx_RefNannyFinishContext();
26384 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_float(PyObject *obj,
int writable_flag) {
26385 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26386 __Pyx_BufFmt_StackElem stack[1];
26387 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26389 if (obj == Py_None) {
26390 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26393 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26394 PyBUF_RECORDS_RO | writable_flag, 1,
26395 &__Pyx_TypeInfo_float, stack,
26397 if (unlikely(retcode == -1))
26401 result.memview = NULL;
26402 result.data = NULL;
26407 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_float(PyObject *obj,
int writable_flag) {
26408 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26409 __Pyx_BufFmt_StackElem stack[1];
26410 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26412 if (obj == Py_None) {
26413 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26416 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26417 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26418 &__Pyx_TypeInfo_float, stack,
26420 if (unlikely(retcode == -1))
26424 result.memview = NULL;
26425 result.data = NULL;
26430 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_int(PyObject *obj,
int writable_flag) {
26431 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26432 __Pyx_BufFmt_StackElem stack[1];
26433 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26435 if (obj == Py_None) {
26436 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26439 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26440 PyBUF_RECORDS_RO | writable_flag, 1,
26441 &__Pyx_TypeInfo_int, stack,
26443 if (unlikely(retcode == -1))
26447 result.memview = NULL;
26448 result.data = NULL;
26453 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_double(PyObject *obj,
int writable_flag) {
26454 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26455 __Pyx_BufFmt_StackElem stack[1];
26456 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26458 if (obj == Py_None) {
26459 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26462 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26463 PyBUF_RECORDS_RO | writable_flag, 1,
26464 &__Pyx_TypeInfo_double, stack,
26466 if (unlikely(retcode == -1))
26470 result.memview = NULL;
26471 result.data = NULL;
26476 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_double(PyObject *obj,
int writable_flag) {
26477 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26478 __Pyx_BufFmt_StackElem stack[1];
26479 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26481 if (obj == Py_None) {
26482 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26485 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26486 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26487 &__Pyx_TypeInfo_double, stack,
26489 if (unlikely(retcode == -1))
26493 result.memview = NULL;
26494 result.data = NULL;
26499 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_ds_long__double(PyObject *obj,
int writable_flag) {
26500 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26501 __Pyx_BufFmt_StackElem stack[1];
26502 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_STRIDED) };
26504 if (obj == Py_None) {
26505 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26508 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, 0,
26509 PyBUF_RECORDS_RO | writable_flag, 1,
26510 &__Pyx_TypeInfo_long__double, stack,
26512 if (unlikely(retcode == -1))
26516 result.memview = NULL;
26517 result.data = NULL;
26522 static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_long__double(PyObject *obj,
int writable_flag) {
26523 __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } };
26524 __Pyx_BufFmt_StackElem stack[1];
26525 int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_FOLLOW), (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) };
26527 if (obj == Py_None) {
26528 result.memview = (
struct __pyx_memoryview_obj *) Py_None;
26531 retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG,
26532 (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 2,
26533 &__Pyx_TypeInfo_long__double, stack,
26535 if (unlikely(retcode == -1))
26539 result.memview = NULL;
26540 result.data = NULL;
26545 #if CYTHON_CCOMPLEX
26547 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26548 return ::std::complex< float >(x, y);
26551 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26552 return x + y*(__pyx_t_float_complex)_Complex_I;
26556 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(
float x,
float y) {
26557 __pyx_t_float_complex z;
26565 #if CYTHON_CCOMPLEX
26567 static CYTHON_INLINE
int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26568 return (a.real == b.real) && (a.imag == b.imag);
26570 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26571 __pyx_t_float_complex z;
26572 z.real = a.real + b.real;
26573 z.imag = a.imag + b.imag;
26576 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26577 __pyx_t_float_complex z;
26578 z.real = a.real - b.real;
26579 z.imag = a.imag - b.imag;
26582 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26583 __pyx_t_float_complex z;
26584 z.real = a.real * b.real - a.imag * b.imag;
26585 z.imag = a.real * b.imag + a.imag * b.real;
26589 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26591 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26592 }
else if (fabsf(b.real) >= fabsf(b.imag)) {
26593 if (b.real == 0 && b.imag == 0) {
26594 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
26596 float r = b.imag / b.real;
26597 float s = (float)(1.0) / (b.real + b.imag * r);
26598 return __pyx_t_float_complex_from_parts(
26599 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26602 float r = b.real / b.imag;
26603 float s = (float)(1.0) / (b.imag + b.real * r);
26604 return __pyx_t_float_complex_from_parts(
26605 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26609 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26611 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
26613 float denom = b.real * b.real + b.imag * b.imag;
26614 return __pyx_t_float_complex_from_parts(
26615 (a.real * b.real + a.imag * b.imag) / denom,
26616 (a.imag * b.real - a.real * b.imag) / denom);
26620 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
26621 __pyx_t_float_complex z;
26626 static CYTHON_INLINE
int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
26627 return (a.real == 0) && (a.imag == 0);
26629 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
26630 __pyx_t_float_complex z;
26636 static CYTHON_INLINE
float __Pyx_c_abs_float(__pyx_t_float_complex z) {
26637 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26638 return sqrtf(z.real*z.real + z.imag*z.imag);
26640 return hypotf(z.real, z.imag);
26643 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
26644 __pyx_t_float_complex z;
26645 float r, lnr, theta, z_r, z_theta;
26646 if (b.imag == 0 && b.real == (
int)b.real) {
26648 float denom = a.real * a.real + a.imag * a.imag;
26649 a.real = a.real / denom;
26650 a.imag = -a.imag / denom;
26653 switch ((
int)b.real) {
26661 return __Pyx_c_prod_float(a, a);
26663 z = __Pyx_c_prod_float(a, a);
26664 return __Pyx_c_prod_float(z, a);
26666 z = __Pyx_c_prod_float(a, a);
26667 return __Pyx_c_prod_float(z, z);
26673 }
else if ((b.imag == 0) && (a.real >= 0)) {
26674 z.real = powf(a.real, b.real);
26677 }
else if (a.real > 0) {
26682 theta = atan2f(0.0, -1.0);
26685 r = __Pyx_c_abs_float(a);
26686 theta = atan2f(a.imag, a.real);
26689 z_r = expf(lnr * b.real - theta * b.imag);
26690 z_theta = theta * b.real + lnr * b.imag;
26691 z.real = z_r * cosf(z_theta);
26692 z.imag = z_r * sinf(z_theta);
26699 #if CYTHON_CCOMPLEX
26701 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26702 return ::std::complex< double >(x, y);
26705 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26706 return x + y*(__pyx_t_double_complex)_Complex_I;
26710 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(
double x,
double y) {
26711 __pyx_t_double_complex z;
26719 #if CYTHON_CCOMPLEX
26721 static CYTHON_INLINE
int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26722 return (a.real == b.real) && (a.imag == b.imag);
26724 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26725 __pyx_t_double_complex z;
26726 z.real = a.real + b.real;
26727 z.imag = a.imag + b.imag;
26730 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26731 __pyx_t_double_complex z;
26732 z.real = a.real - b.real;
26733 z.imag = a.imag - b.imag;
26736 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26737 __pyx_t_double_complex z;
26738 z.real = a.real * b.real - a.imag * b.imag;
26739 z.imag = a.real * b.imag + a.imag * b.real;
26743 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26745 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26746 }
else if (fabs(b.real) >= fabs(b.imag)) {
26747 if (b.real == 0 && b.imag == 0) {
26748 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
26750 double r = b.imag / b.real;
26751 double s = (double)(1.0) / (b.real + b.imag * r);
26752 return __pyx_t_double_complex_from_parts(
26753 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
26756 double r = b.real / b.imag;
26757 double s = (double)(1.0) / (b.imag + b.real * r);
26758 return __pyx_t_double_complex_from_parts(
26759 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
26763 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26765 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
26767 double denom = b.real * b.real + b.imag * b.imag;
26768 return __pyx_t_double_complex_from_parts(
26769 (a.real * b.real + a.imag * b.imag) / denom,
26770 (a.imag * b.real - a.real * b.imag) / denom);
26774 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
26775 __pyx_t_double_complex z;
26780 static CYTHON_INLINE
int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
26781 return (a.real == 0) && (a.imag == 0);
26783 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
26784 __pyx_t_double_complex z;
26790 static CYTHON_INLINE
double __Pyx_c_abs_double(__pyx_t_double_complex z) {
26791 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
26792 return sqrt(z.real*z.real + z.imag*z.imag);
26794 return hypot(z.real, z.imag);
26797 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
26798 __pyx_t_double_complex z;
26799 double r, lnr, theta, z_r, z_theta;
26800 if (b.imag == 0 && b.real == (
int)b.real) {
26802 double denom = a.real * a.real + a.imag * a.imag;
26803 a.real = a.real / denom;
26804 a.imag = -a.imag / denom;
26807 switch ((
int)b.real) {
26815 return __Pyx_c_prod_double(a, a);
26817 z = __Pyx_c_prod_double(a, a);
26818 return __Pyx_c_prod_double(z, a);
26820 z = __Pyx_c_prod_double(a, a);
26821 return __Pyx_c_prod_double(z, z);
26827 }
else if ((b.imag == 0) && (a.real >= 0)) {
26828 z.real = pow(a.real, b.real);
26831 }
else if (a.real > 0) {
26836 theta = atan2(0.0, -1.0);
26839 r = __Pyx_c_abs_double(a);
26840 theta = atan2(a.imag, a.real);
26843 z_r = exp(lnr * b.real - theta * b.imag);
26844 z_theta = theta * b.real + lnr * b.imag;
26845 z.real = z_r * cos(z_theta);
26846 z.imag = z_r * sin(z_theta);
26853 static __Pyx_memviewslice
26854 __pyx_memoryview_copy_new_contig(
const __Pyx_memviewslice *from_mvs,
26855 const char *mode,
int ndim,
26856 size_t sizeof_dtype,
int contig_flag,
26857 int dtype_is_object)
26859 __Pyx_RefNannyDeclarations
26861 __Pyx_memviewslice new_mvs = { 0, 0, { 0 }, { 0 }, { 0 } };
26862 struct __pyx_memoryview_obj *from_memview = from_mvs->memview;
26863 Py_buffer *buf = &from_memview->view;
26864 PyObject *shape_tuple = NULL;
26865 PyObject *temp_int = NULL;
26866 struct __pyx_array_obj *array_obj = NULL;
26867 struct __pyx_memoryview_obj *memview_obj = NULL;
26868 __Pyx_RefNannySetupContext(
"__pyx_memoryview_copy_new_contig", 0);
26869 for (i = 0; i < ndim; i++) {
26870 if (unlikely(from_mvs->suboffsets[i] >= 0)) {
26871 PyErr_Format(PyExc_ValueError,
"Cannot copy memoryview slice with "
26872 "indirect dimensions (axis %d)", i);
26876 shape_tuple = PyTuple_New(ndim);
26877 if (unlikely(!shape_tuple)) {
26880 __Pyx_GOTREF(shape_tuple);
26881 for(i = 0; i < ndim; i++) {
26882 temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
26883 if(unlikely(!temp_int)) {
26886 PyTuple_SET_ITEM(shape_tuple, i, temp_int);
26890 array_obj = __pyx_array_new(shape_tuple, sizeof_dtype, buf->format, (
char *) mode, NULL);
26891 if (unlikely(!array_obj)) {
26894 __Pyx_GOTREF(array_obj);
26895 memview_obj = (
struct __pyx_memoryview_obj *) __pyx_memoryview_new(
26896 (PyObject *) array_obj, contig_flag,
26898 from_mvs->memview->typeinfo);
26899 if (unlikely(!memview_obj))
26901 if (unlikely(__Pyx_init_memviewslice(memview_obj, ndim, &new_mvs, 1) < 0))
26903 if (unlikely(__pyx_memoryview_copy_contents(*from_mvs, new_mvs, ndim, ndim,
26904 dtype_is_object) < 0))
26908 __Pyx_XDECREF(new_mvs.memview);
26909 new_mvs.memview = NULL;
26910 new_mvs.data = NULL;
26912 __Pyx_XDECREF(shape_tuple);
26913 __Pyx_XDECREF(temp_int);
26914 __Pyx_XDECREF(array_obj);
26915 __Pyx_RefNannyFinishContext();
26920 static CYTHON_INLINE
int __Pyx_PyInt_As_int(PyObject *x) {
26921 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26922 #pragma GCC diagnostic push
26923 #pragma GCC diagnostic ignored "-Wconversion"
26925 const int neg_one = (int) -1, const_zero = (
int) 0;
26926 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
26927 #pragma GCC diagnostic pop
26929 const int is_unsigned = neg_one > const_zero;
26930 #if PY_MAJOR_VERSION < 3
26931 if (likely(PyInt_Check(x))) {
26932 if (
sizeof(
int) <
sizeof(long)) {
26933 __PYX_VERIFY_RETURN_INT(
int,
long, PyInt_AS_LONG(x))
26935 long val = PyInt_AS_LONG(x);
26936 if (is_unsigned && unlikely(val < 0)) {
26937 goto raise_neg_overflow;
26943 if (likely(PyLong_Check(x))) {
26945 #if CYTHON_USE_PYLONG_INTERNALS
26946 const digit* digits = ((PyLongObject*)x)->ob_digit;
26947 switch (Py_SIZE(x)) {
26948 case 0:
return (
int) 0;
26949 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, digits[0])
26951 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
26952 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
26953 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26954 }
else if (8 *
sizeof(
int) >= 2 * PyLong_SHIFT) {
26955 return (
int) (((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26960 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
26961 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
26962 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26963 }
else if (8 *
sizeof(
int) >= 3 * PyLong_SHIFT) {
26964 return (
int) (((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
26969 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
26970 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
26971 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
26972 }
else if (8 *
sizeof(
int) >= 4 * PyLong_SHIFT) {
26973 return (
int) (((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0]));
26979 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
26980 if (unlikely(Py_SIZE(x) < 0)) {
26981 goto raise_neg_overflow;
26985 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
26986 if (unlikely(result < 0))
26988 if (unlikely(result == 1))
26989 goto raise_neg_overflow;
26992 if (
sizeof(
int) <=
sizeof(
unsigned long)) {
26993 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned long, PyLong_AsUnsignedLong(x))
26994 #ifdef HAVE_LONG_LONG
26995 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
26996 __PYX_VERIFY_RETURN_INT_EXC(
int,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27000 #if CYTHON_USE_PYLONG_INTERNALS
27001 const digit* digits = ((PyLongObject*)x)->ob_digit;
27002 switch (Py_SIZE(x)) {
27003 case 0:
return (
int) 0;
27004 case -1: __PYX_VERIFY_RETURN_INT(
int, sdigit, (sdigit) (-(sdigit)digits[0]))
27005 case 1: __PYX_VERIFY_RETURN_INT(
int, digit, +digits[0])
27007 if (8 *
sizeof(
int) - 1 > 1 * PyLong_SHIFT) {
27008 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27009 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27010 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27011 return (
int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27016 if (8 *
sizeof(
int) > 1 * PyLong_SHIFT) {
27017 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27018 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27019 }
else if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27020 return (
int) ((((((int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27025 if (8 *
sizeof(
int) - 1 > 2 * PyLong_SHIFT) {
27026 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27027 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27028 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27029 return (
int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27034 if (8 *
sizeof(
int) > 2 * PyLong_SHIFT) {
27035 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27036 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27037 }
else if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27038 return (
int) ((((((((int)digits[2]) << PyLong_SHIFT) | (
int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
27043 if (8 *
sizeof(
int) - 1 > 3 * PyLong_SHIFT) {
27044 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27045 __PYX_VERIFY_RETURN_INT(
int,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27046 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27047 return (
int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27052 if (8 *
sizeof(
int) > 3 * PyLong_SHIFT) {
27053 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27054 __PYX_VERIFY_RETURN_INT(
int,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27055 }
else if (8 *
sizeof(
int) - 1 > 4 * PyLong_SHIFT) {
27056 return (
int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (
int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (
int)digits[0])));
27062 if (
sizeof(
int) <=
sizeof(long)) {
27063 __PYX_VERIFY_RETURN_INT_EXC(
int,
long, PyLong_AsLong(x))
27064 #ifdef HAVE_LONG_LONG
27065 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27066 __PYX_VERIFY_RETURN_INT_EXC(
int, PY_LONG_LONG, PyLong_AsLongLong(x))
27071 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27072 PyErr_SetString(PyExc_RuntimeError,
27073 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27076 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27077 #if PY_MAJOR_VERSION < 3
27078 if (likely(v) && !PyLong_Check(v)) {
27080 v = PyNumber_Long(tmp);
27085 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27086 unsigned char *bytes = (
unsigned char *)&val;
27087 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27088 bytes,
sizeof(val),
27089 is_little, !is_unsigned);
27099 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27100 if (!tmp)
return (
int) -1;
27101 val = __Pyx_PyInt_As_int(tmp);
27106 PyErr_SetString(PyExc_OverflowError,
27107 "value too large to convert to int");
27109 raise_neg_overflow:
27110 PyErr_SetString(PyExc_OverflowError,
27111 "can't convert negative value to int");
27116 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(
long value) {
27117 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27118 #pragma GCC diagnostic push
27119 #pragma GCC diagnostic ignored "-Wconversion"
27121 const long neg_one = (long) -1, const_zero = (
long) 0;
27122 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27123 #pragma GCC diagnostic pop
27125 const int is_unsigned = neg_one > const_zero;
27127 if (
sizeof(
long) <
sizeof(long)) {
27128 return PyInt_FromLong((
long) value);
27129 }
else if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27130 return PyLong_FromUnsignedLong((
unsigned long) value);
27131 #ifdef HAVE_LONG_LONG
27132 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27133 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27137 if (
sizeof(
long) <=
sizeof(
long)) {
27138 return PyInt_FromLong((
long) value);
27139 #ifdef HAVE_LONG_LONG
27140 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27141 return PyLong_FromLongLong((PY_LONG_LONG) value);
27146 int one = 1;
int little = (int)*(
unsigned char *)&one;
27147 unsigned char *bytes = (
unsigned char *)&value;
27148 return _PyLong_FromByteArray(bytes,
sizeof(
long),
27149 little, !is_unsigned);
27154 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(
int value) {
27155 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27156 #pragma GCC diagnostic push
27157 #pragma GCC diagnostic ignored "-Wconversion"
27159 const int neg_one = (int) -1, const_zero = (
int) 0;
27160 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27161 #pragma GCC diagnostic pop
27163 const int is_unsigned = neg_one > const_zero;
27165 if (
sizeof(
int) <
sizeof(long)) {
27166 return PyInt_FromLong((
long) value);
27167 }
else if (
sizeof(
int) <=
sizeof(
unsigned long)) {
27168 return PyLong_FromUnsignedLong((
unsigned long) value);
27169 #ifdef HAVE_LONG_LONG
27170 }
else if (
sizeof(
int) <=
sizeof(
unsigned PY_LONG_LONG)) {
27171 return PyLong_FromUnsignedLongLong((
unsigned PY_LONG_LONG) value);
27175 if (
sizeof(
int) <=
sizeof(
long)) {
27176 return PyInt_FromLong((
long) value);
27177 #ifdef HAVE_LONG_LONG
27178 }
else if (
sizeof(
int) <=
sizeof(PY_LONG_LONG)) {
27179 return PyLong_FromLongLong((PY_LONG_LONG) value);
27184 int one = 1;
int little = (int)*(
unsigned char *)&one;
27185 unsigned char *bytes = (
unsigned char *)&value;
27186 return _PyLong_FromByteArray(bytes,
sizeof(
int),
27187 little, !is_unsigned);
27192 static CYTHON_INLINE
long __Pyx_PyInt_As_long(PyObject *x) {
27193 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27194 #pragma GCC diagnostic push
27195 #pragma GCC diagnostic ignored "-Wconversion"
27197 const long neg_one = (long) -1, const_zero = (
long) 0;
27198 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27199 #pragma GCC diagnostic pop
27201 const int is_unsigned = neg_one > const_zero;
27202 #if PY_MAJOR_VERSION < 3
27203 if (likely(PyInt_Check(x))) {
27204 if (
sizeof(
long) <
sizeof(long)) {
27205 __PYX_VERIFY_RETURN_INT(
long,
long, PyInt_AS_LONG(x))
27207 long val = PyInt_AS_LONG(x);
27208 if (is_unsigned && unlikely(val < 0)) {
27209 goto raise_neg_overflow;
27215 if (likely(PyLong_Check(x))) {
27217 #if CYTHON_USE_PYLONG_INTERNALS
27218 const digit* digits = ((PyLongObject*)x)->ob_digit;
27219 switch (Py_SIZE(x)) {
27220 case 0:
return (
long) 0;
27221 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, digits[0])
27223 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27224 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27225 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27226 }
else if (8 *
sizeof(
long) >= 2 * PyLong_SHIFT) {
27227 return (
long) (((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27232 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27233 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27234 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27235 }
else if (8 *
sizeof(
long) >= 3 * PyLong_SHIFT) {
27236 return (
long) (((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
27241 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27242 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27243 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27244 }
else if (8 *
sizeof(
long) >= 4 * PyLong_SHIFT) {
27245 return (
long) (((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0]));
27251 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27252 if (unlikely(Py_SIZE(x) < 0)) {
27253 goto raise_neg_overflow;
27257 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27258 if (unlikely(result < 0))
27260 if (unlikely(result == 1))
27261 goto raise_neg_overflow;
27264 if (
sizeof(
long) <=
sizeof(
unsigned long)) {
27265 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned long, PyLong_AsUnsignedLong(x))
27266 #ifdef HAVE_LONG_LONG
27267 }
else if (
sizeof(
long) <=
sizeof(
unsigned PY_LONG_LONG)) {
27268 __PYX_VERIFY_RETURN_INT_EXC(
long,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27272 #if CYTHON_USE_PYLONG_INTERNALS
27273 const digit* digits = ((PyLongObject*)x)->ob_digit;
27274 switch (Py_SIZE(x)) {
27275 case 0:
return (
long) 0;
27276 case -1: __PYX_VERIFY_RETURN_INT(
long, sdigit, (sdigit) (-(sdigit)digits[0]))
27277 case 1: __PYX_VERIFY_RETURN_INT(
long, digit, +digits[0])
27279 if (8 *
sizeof(
long) - 1 > 1 * PyLong_SHIFT) {
27280 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27281 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27282 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27283 return (
long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27288 if (8 *
sizeof(
long) > 1 * PyLong_SHIFT) {
27289 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27290 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27291 }
else if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27292 return (
long) ((((((long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27297 if (8 *
sizeof(
long) - 1 > 2 * PyLong_SHIFT) {
27298 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27299 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27300 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27301 return (
long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27306 if (8 *
sizeof(
long) > 2 * PyLong_SHIFT) {
27307 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27308 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27309 }
else if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27310 return (
long) ((((((((long)digits[2]) << PyLong_SHIFT) | (
long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
27315 if (8 *
sizeof(
long) - 1 > 3 * PyLong_SHIFT) {
27316 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27317 __PYX_VERIFY_RETURN_INT(
long,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27318 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27319 return (
long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27324 if (8 *
sizeof(
long) > 3 * PyLong_SHIFT) {
27325 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27326 __PYX_VERIFY_RETURN_INT(
long,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27327 }
else if (8 *
sizeof(
long) - 1 > 4 * PyLong_SHIFT) {
27328 return (
long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (
long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (
long)digits[0])));
27334 if (
sizeof(
long) <=
sizeof(long)) {
27335 __PYX_VERIFY_RETURN_INT_EXC(
long,
long, PyLong_AsLong(x))
27336 #ifdef HAVE_LONG_LONG
27337 }
else if (
sizeof(
long) <=
sizeof(PY_LONG_LONG)) {
27338 __PYX_VERIFY_RETURN_INT_EXC(
long, PY_LONG_LONG, PyLong_AsLongLong(x))
27343 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27344 PyErr_SetString(PyExc_RuntimeError,
27345 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27348 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27349 #if PY_MAJOR_VERSION < 3
27350 if (likely(v) && !PyLong_Check(v)) {
27352 v = PyNumber_Long(tmp);
27357 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27358 unsigned char *bytes = (
unsigned char *)&val;
27359 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27360 bytes,
sizeof(val),
27361 is_little, !is_unsigned);
27371 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27372 if (!tmp)
return (
long) -1;
27373 val = __Pyx_PyInt_As_long(tmp);
27378 PyErr_SetString(PyExc_OverflowError,
27379 "value too large to convert to long");
27381 raise_neg_overflow:
27382 PyErr_SetString(PyExc_OverflowError,
27383 "can't convert negative value to long");
27388 static CYTHON_INLINE
char __Pyx_PyInt_As_char(PyObject *x) {
27389 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27390 #pragma GCC diagnostic push
27391 #pragma GCC diagnostic ignored "-Wconversion"
27393 const char neg_one = (char) -1, const_zero = (
char) 0;
27394 #ifdef __Pyx_HAS_GCC_DIAGNOSTIC
27395 #pragma GCC diagnostic pop
27397 const int is_unsigned = neg_one > const_zero;
27398 #if PY_MAJOR_VERSION < 3
27399 if (likely(PyInt_Check(x))) {
27400 if (
sizeof(
char) <
sizeof(long)) {
27401 __PYX_VERIFY_RETURN_INT(
char,
long, PyInt_AS_LONG(x))
27403 long val = PyInt_AS_LONG(x);
27404 if (is_unsigned && unlikely(val < 0)) {
27405 goto raise_neg_overflow;
27411 if (likely(PyLong_Check(x))) {
27413 #if CYTHON_USE_PYLONG_INTERNALS
27414 const digit* digits = ((PyLongObject*)x)->ob_digit;
27415 switch (Py_SIZE(x)) {
27416 case 0:
return (
char) 0;
27417 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, digits[0])
27419 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27420 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27421 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27422 }
else if (8 *
sizeof(
char) >= 2 * PyLong_SHIFT) {
27423 return (
char) (((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27428 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27429 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27430 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27431 }
else if (8 *
sizeof(
char) >= 3 * PyLong_SHIFT) {
27432 return (
char) (((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0]));
27437 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27438 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27439 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27440 }
else if (8 *
sizeof(
char) >= 4 * PyLong_SHIFT) {
27441 return (
char) (((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0]));
27447 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030C00A7
27448 if (unlikely(Py_SIZE(x) < 0)) {
27449 goto raise_neg_overflow;
27453 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
27454 if (unlikely(result < 0))
27456 if (unlikely(result == 1))
27457 goto raise_neg_overflow;
27460 if (
sizeof(
char) <=
sizeof(
unsigned long)) {
27461 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned long, PyLong_AsUnsignedLong(x))
27462 #ifdef HAVE_LONG_LONG
27463 }
else if (
sizeof(
char) <=
sizeof(
unsigned PY_LONG_LONG)) {
27464 __PYX_VERIFY_RETURN_INT_EXC(
char,
unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
27468 #if CYTHON_USE_PYLONG_INTERNALS
27469 const digit* digits = ((PyLongObject*)x)->ob_digit;
27470 switch (Py_SIZE(x)) {
27471 case 0:
return (
char) 0;
27472 case -1: __PYX_VERIFY_RETURN_INT(
char, sdigit, (sdigit) (-(sdigit)digits[0]))
27473 case 1: __PYX_VERIFY_RETURN_INT(
char, digit, +digits[0])
27475 if (8 *
sizeof(
char) - 1 > 1 * PyLong_SHIFT) {
27476 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27477 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27478 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27479 return (
char) (((char)-1)*(((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27484 if (8 *
sizeof(
char) > 1 * PyLong_SHIFT) {
27485 if (8 *
sizeof(
unsigned long) > 2 * PyLong_SHIFT) {
27486 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27487 }
else if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27488 return (
char) ((((((char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27493 if (8 *
sizeof(
char) - 1 > 2 * PyLong_SHIFT) {
27494 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27495 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27496 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27497 return (
char) (((char)-1)*(((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27502 if (8 *
sizeof(
char) > 2 * PyLong_SHIFT) {
27503 if (8 *
sizeof(
unsigned long) > 3 * PyLong_SHIFT) {
27504 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27505 }
else if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27506 return (
char) ((((((((char)digits[2]) << PyLong_SHIFT) | (
char)digits[1]) << PyLong_SHIFT) | (char)digits[0])));
27511 if (8 *
sizeof(
char) - 1 > 3 * PyLong_SHIFT) {
27512 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27513 __PYX_VERIFY_RETURN_INT(
char,
long, -(
long) (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27514 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27515 return (
char) (((char)-1)*(((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27520 if (8 *
sizeof(
char) > 3 * PyLong_SHIFT) {
27521 if (8 *
sizeof(
unsigned long) > 4 * PyLong_SHIFT) {
27522 __PYX_VERIFY_RETURN_INT(
char,
unsigned long, (((((((((
unsigned long)digits[3]) << PyLong_SHIFT) | (
unsigned long)digits[2]) << PyLong_SHIFT) | (
unsigned long)digits[1]) << PyLong_SHIFT) | (
unsigned long)digits[0])))
27523 }
else if (8 *
sizeof(
char) - 1 > 4 * PyLong_SHIFT) {
27524 return (
char) ((((((((((char)digits[3]) << PyLong_SHIFT) | (
char)digits[2]) << PyLong_SHIFT) | (char)digits[1]) << PyLong_SHIFT) | (
char)digits[0])));
27530 if (
sizeof(
char) <=
sizeof(long)) {
27531 __PYX_VERIFY_RETURN_INT_EXC(
char,
long, PyLong_AsLong(x))
27532 #ifdef HAVE_LONG_LONG
27533 }
else if (
sizeof(
char) <=
sizeof(PY_LONG_LONG)) {
27534 __PYX_VERIFY_RETURN_INT_EXC(
char, PY_LONG_LONG, PyLong_AsLongLong(x))
27539 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
27540 PyErr_SetString(PyExc_RuntimeError,
27541 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
27544 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
27545 #if PY_MAJOR_VERSION < 3
27546 if (likely(v) && !PyLong_Check(v)) {
27548 v = PyNumber_Long(tmp);
27553 int one = 1;
int is_little = (int)*(
unsigned char *)&one;
27554 unsigned char *bytes = (
unsigned char *)&val;
27555 int ret = _PyLong_AsByteArray((PyLongObject *)v,
27556 bytes,
sizeof(val),
27557 is_little, !is_unsigned);
27567 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
27568 if (!tmp)
return (
char) -1;
27569 val = __Pyx_PyInt_As_char(tmp);
27574 PyErr_SetString(PyExc_OverflowError,
27575 "value too large to convert to char");
27577 raise_neg_overflow:
27578 PyErr_SetString(PyExc_OverflowError,
27579 "can't convert negative value to char");
27584 static int __Pyx_check_binary_version(
void) {
27586 int same=1, i, found_dot;
27587 const char* rt_from_call = Py_GetVersion();
27588 PyOS_snprintf(ctversion, 5,
"%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
27590 for (i = 0; i < 4; i++) {
27591 if (!ctversion[i]) {
27592 same = (rt_from_call[i] <
'0' || rt_from_call[i] >
'9');
27595 if (rt_from_call[i] != ctversion[i]) {
27601 char rtversion[5] = {
'\0'};
27603 for (i=0; i<4; ++i) {
27604 if (rt_from_call[i] ==
'.') {
27605 if (found_dot)
break;
27607 }
else if (rt_from_call[i] <
'0' || rt_from_call[i] >
'9') {
27610 rtversion[i] = rt_from_call[i];
27612 PyOS_snprintf(message,
sizeof(message),
27613 "compiletime version %s of module '%.100s' "
27614 "does not match runtime version %s",
27615 ctversion, __Pyx_MODULE_NAME, rtversion);
27616 return PyErr_WarnEx(NULL, message, 1);
27622 static int __Pyx_ExportFunction(
const char *name,
void (*f)(
void),
const char *sig) {
27624 PyObject *cobj = 0;
27629 d = PyObject_GetAttrString(__pyx_m, (
char *)
"__pyx_capi__");
27636 if (PyModule_AddObject(__pyx_m, (
char *)
"__pyx_capi__", d) < 0)
27640 #if PY_VERSION_HEX >= 0x02070000
27641 cobj = PyCapsule_New(tmp.p, sig, 0);
27643 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (
void *)sig, 0);
27647 if (PyDict_SetItemString(d, name, cobj) < 0)
27659 #ifndef __PYX_HAVE_RT_ImportFunction_0_29_36
27660 #define __PYX_HAVE_RT_ImportFunction_0_29_36
27661 static int __Pyx_ImportFunction_0_29_36(PyObject *module,
const char *funcname,
void (**f)(
void),
const char *sig) {
27663 PyObject *cobj = 0;
27668 d = PyObject_GetAttrString(module, (
char *)
"__pyx_capi__");
27671 cobj = PyDict_GetItemString(d, funcname);
27673 PyErr_Format(PyExc_ImportError,
27674 "%.200s does not export expected C function %.200s",
27675 PyModule_GetName(module), funcname);
27678 #if PY_VERSION_HEX >= 0x02070000
27679 if (!PyCapsule_IsValid(cobj, sig)) {
27680 PyErr_Format(PyExc_TypeError,
27681 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27682 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
27685 tmp.p = PyCapsule_GetPointer(cobj, sig);
27687 {
const char *desc, *s1, *s2;
27688 desc = (
const char *)PyCObject_GetDesc(cobj);
27691 s1 = desc; s2 = sig;
27692 while (*s1 !=
'\0' && *s1 == *s2) { s1++; s2++; }
27694 PyErr_Format(PyExc_TypeError,
27695 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
27696 PyModule_GetName(module), funcname, sig, desc);
27699 tmp.p = PyCObject_AsVoidPtr(cobj);}
27713 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
27715 #if PY_MAJOR_VERSION < 3
27716 if (t->is_unicode) {
27717 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
27718 }
else if (t->intern) {
27719 *t->p = PyString_InternFromString(t->s);
27721 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
27724 if (t->is_unicode | t->is_str) {
27726 *t->p = PyUnicode_InternFromString(t->s);
27727 }
else if (t->encoding) {
27728 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
27730 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
27733 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
27738 if (PyObject_Hash(*t->p) == -1)
27745 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(
const char* c_str) {
27746 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
27748 static CYTHON_INLINE
const char* __Pyx_PyObject_AsString(PyObject* o) {
27750 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
27752 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27753 #if !CYTHON_PEP393_ENABLED
27754 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27756 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
27757 if (!defenc)
return NULL;
27758 defenc_c = PyBytes_AS_STRING(defenc);
27759 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27761 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
27763 for (c = defenc_c; c < end; c++) {
27764 if ((
unsigned char) (*c) >= 128) {
27765 PyUnicode_AsASCIIString(o);
27771 *length = PyBytes_GET_SIZE(defenc);
27775 static CYTHON_INLINE
const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27776 if (unlikely(__Pyx_PyUnicode_READY(o) == -1))
return NULL;
27777 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27778 if (likely(PyUnicode_IS_ASCII(o))) {
27779 *length = PyUnicode_GET_LENGTH(o);
27780 return PyUnicode_AsUTF8(o);
27782 PyUnicode_AsASCIIString(o);
27786 return PyUnicode_AsUTF8AndSize(o, length);
27791 static CYTHON_INLINE
const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
27792 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
27794 #
if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
27795 __Pyx_sys_getdefaultencoding_not_ascii &&
27797 PyUnicode_Check(o)) {
27798 return __Pyx_PyUnicode_AsStringAndSize(o, length);
27801 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
27802 if (PyByteArray_Check(o)) {
27803 *length = PyByteArray_GET_SIZE(o);
27804 return PyByteArray_AS_STRING(o);
27809 int r = PyBytes_AsStringAndSize(o, &result, length);
27810 if (unlikely(r < 0)) {
27817 static CYTHON_INLINE
int __Pyx_PyObject_IsTrue(PyObject* x) {
27818 int is_true = x == Py_True;
27819 if (is_true | (x == Py_False) | (x == Py_None))
return is_true;
27820 else return PyObject_IsTrue(x);
27822 static CYTHON_INLINE
int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
27824 if (unlikely(!x))
return -1;
27825 retval = __Pyx_PyObject_IsTrue(x);
27829 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result,
const char* type_name) {
27830 #if PY_MAJOR_VERSION >= 3
27831 if (PyLong_Check(result)) {
27832 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
27833 "__int__ returned non-int (type %.200s). "
27834 "The ability to return an instance of a strict subclass of int "
27835 "is deprecated, and may be removed in a future version of Python.",
27836 Py_TYPE(result)->tp_name)) {
27843 PyErr_Format(PyExc_TypeError,
27844 "__%.4s__ returned non-%.4s (type %.200s)",
27845 type_name, type_name, Py_TYPE(result)->tp_name);
27849 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
27850 #if CYTHON_USE_TYPE_SLOTS
27851 PyNumberMethods *m;
27853 const char *name = NULL;
27854 PyObject *res = NULL;
27855 #if PY_MAJOR_VERSION < 3
27856 if (likely(PyInt_Check(x) || PyLong_Check(x)))
27858 if (likely(PyLong_Check(x)))
27860 return __Pyx_NewRef(x);
27861 #if CYTHON_USE_TYPE_SLOTS
27862 m = Py_TYPE(x)->tp_as_number;
27863 #if PY_MAJOR_VERSION < 3
27864 if (m && m->nb_int) {
27866 res = m->nb_int(x);
27868 else if (m && m->nb_long) {
27870 res = m->nb_long(x);
27873 if (likely(m && m->nb_int)) {
27875 res = m->nb_int(x);
27879 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
27880 res = PyNumber_Int(x);
27884 #if PY_MAJOR_VERSION < 3
27885 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
27887 if (unlikely(!PyLong_CheckExact(res))) {
27889 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
27892 else if (!PyErr_Occurred()) {
27893 PyErr_SetString(PyExc_TypeError,
27894 "an integer is required");
27898 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
27901 #if PY_MAJOR_VERSION < 3
27902 if (likely(PyInt_CheckExact(b))) {
27903 if (
sizeof(Py_ssize_t) >=
sizeof(
long))
27904 return PyInt_AS_LONG(b);
27906 return PyInt_AsSsize_t(b);
27909 if (likely(PyLong_CheckExact(b))) {
27910 #if CYTHON_USE_PYLONG_INTERNALS
27911 const digit* digits = ((PyLongObject*)b)->ob_digit;
27912 const Py_ssize_t size = Py_SIZE(b);
27913 if (likely(__Pyx_sst_abs(size) <= 1)) {
27914 ival = likely(size) ? digits[0] : 0;
27915 if (size == -1) ival = -ival;
27920 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27921 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27925 if (8 *
sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
27926 return -(Py_ssize_t) (((((
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27930 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27931 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27935 if (8 *
sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
27936 return -(Py_ssize_t) (((((((
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27940 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27941 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (
size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (
size_t)digits[0]));
27945 if (8 *
sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
27946 return -(Py_ssize_t) (((((((((
size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (
size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
27952 return PyLong_AsSsize_t(b);
27954 x = PyNumber_Index(b);
27956 ival = PyInt_AsSsize_t(x);
27960 static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) {
27961 if (
sizeof(Py_hash_t) ==
sizeof(Py_ssize_t)) {
27962 return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o);
27963 #if PY_MAJOR_VERSION < 3
27964 }
else if (likely(PyInt_CheckExact(o))) {
27965 return PyInt_AS_LONG(o);
27970 x = PyNumber_Index(o);
27972 ival = PyInt_AsLong(x);
27977 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(
long b) {
27978 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
27980 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(
size_t ival) {
27981 return PyInt_FromSize_t(ival);
Base class for linear operators. This class serves as interface for all derived classes.
static FlagType c_trace_estimator(cLinearOperator< DataType > *A, DataType *parameters, const IndexType num_inquiries, const Function *matrix_function, const FlagType gram, const DataType exponent, const FlagType orthogonalize, const IndexType lanczos_degree, const DataType lanczos_tol, const IndexType min_num_samples, const IndexType max_num_samples, const DataType error_atol, const DataType error_rtol, const DataType confidence_level, const DataType outlier_significance_level, const IndexType num_threads, DataType *trace, DataType *error, DataType **samples, IndexType *processed_samples_indices, IndexType *num_samples_used, IndexType *num_outliers, FlagType *converged, float &alg_wall_time)
Stochastic Lanczos quadrature method to estimate trace of a function of a linear operator....
void lapack_sbdsdc(char *uplo, char *compq, int *n, float *d, float *e, float *u, int *ldu, float *vt, int *ldvt, float *q, int *iq, float *work, int *iwork, int *info)
void lapack_dstev(char *jobz, int *n, double *d, double *e, double *z, int *ldz, double *work, int *info)
void lapack_dbdsdc(char *uplo, char *compq, int *n, double *d, double *e, double *u, int *ldu, double *vt, int *ldvt, double *q, int *iq, double *work, int *iwork, int *info)
__PYX_EXTERN_C void lapack_sstev(char *, int *, float *, float *, float *, int *, float *, int *)
PyMODINIT_FUNC initpy_c_trace_estimator(void)